-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (175 loc) · 7.14 KB
/
release.yml
File metadata and controls
193 lines (175 loc) · 7.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build and Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-2022, macos-latest]
include:
- os: ubuntu-latest
platform: linux
binary_name: smart-commit-linux
- os: windows-2022
platform: windows
binary_name: smart-commit-windows.exe
- os: macos-latest
platform: macos
binary_name: smart-commit-macos
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build binary (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Building Windows binary ==="
pyinstaller `
--onefile `
--name smart-commit `
--add-data "smart_commit/config.yml;smart_commit" `
--collect-submodules click `
--collect-submodules google.generativeai `
--collect-submodules pydantic `
--collect-submodules dotenv `
--hidden-import google.ai.generativelanguage `
--hidden-import pydantic_core `
--hidden-import yaml `
--hidden-import PyYAML `
smart_commit/main.py
echo "=== Build completed, checking dist directory ==="
Get-ChildItem dist/
echo "=== Checking for smart-commit.exe ==="
if (Test-Path "dist/smart-commit.exe") { echo "✅ smart-commit.exe found" } else { echo "❌ smart-commit.exe missing" }
- name: Build binary (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Building Unix binary ==="
pyinstaller \
--onefile \
--name smart-commit \
--add-data "smart_commit/config.yml:smart_commit" \
--collect-submodules click \
--collect-submodules google.generativeai \
--collect-submodules pydantic \
--collect-submodules dotenv \
--hidden-import google.ai.generativelanguage \
--hidden-import pydantic_core \
--hidden-import yaml \
--hidden-import PyYAML \
smart_commit/main.py
echo "=== Build completed, checking dist directory ==="
ls -la dist/
echo "=== Checking for smart-commit ==="
test -f dist/smart-commit && echo "✅ smart-commit found" || echo "❌ smart-commit missing"
- name: Rename binary (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Renaming Windows binary ==="
echo "Source: dist\smart-commit.exe"
echo "Target: dist\${{ matrix.binary_name }}"
Move-Item dist\smart-commit.exe dist\${{ matrix.binary_name }}
echo "=== After rename, checking dist directory ==="
Get-ChildItem dist/
echo "=== Verifying renamed file exists ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { echo "✅ ${{ matrix.binary_name }} found" } else { echo "❌ ${{ matrix.binary_name }} missing" }
- name: Rename binary (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Renaming Unix binary ==="
echo "Source: dist/smart-commit"
echo "Target: dist/${{ matrix.binary_name }}"
mv dist/smart-commit dist/${{ matrix.binary_name }}
echo "=== After rename, checking dist directory ==="
ls -la dist/
echo "=== Verifying renamed file exists ==="
test -f dist/${{ matrix.binary_name }} && echo "✅ ${{ matrix.binary_name }} found" || echo "❌ ${{ matrix.binary_name }} missing"
- name: Check binary before upload (Windows)
if: matrix.platform == 'windows'
shell: powershell
run: |
echo "=== Preparing to upload binary ==="
echo "Binary name: ${{ matrix.binary_name }}"
echo "Path: dist/${{ matrix.binary_name }}"
echo "=== Checking if file exists ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { echo "✅ File exists" } else { echo "❌ File missing" }
echo "=== File size ==="
if (Test-Path "dist/${{ matrix.binary_name }}") { Get-ChildItem "dist/${{ matrix.binary_name }}" | Select-Object Name, Length } else { echo "File not found" }
- name: Check binary before upload (Unix)
if: matrix.platform != 'windows'
shell: bash
run: |
echo "=== Preparing to upload binary ==="
echo "Binary name: ${{ matrix.binary_name }}"
echo "Path: dist/${{ matrix.binary_name }}"
echo "=== Checking if file exists ==="
test -f dist/${{ matrix.binary_name }} && echo "✅ File exists" || echo "❌ File missing"
echo "=== File size ==="
ls -lh dist/${{ matrix.binary_name }} || echo "File not found"
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.binary_name }}
path: dist/${{ matrix.binary_name }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: List downloaded files
run: |
find . -name "smart-commit*" -type f
ls -la
echo "=== Directory structure ==="
find . -type d
echo "=== All files ==="
find . -type f
- name: Move binaries to root and cleanup
run: |
echo "=== Finding all smart-commit files ==="
find . -name "smart-commit*" -type f
echo "=== Moving files to root with temporary names ==="
mv -f ./smart-commit-linux/smart-commit-linux ./smart-commit-linux.bin
mv -f ./smart-commit-macos/smart-commit-macos ./smart-commit-macos.bin
mv -f ./smart-commit-windows.exe/smart-commit-windows.exe ./smart-commit-windows.exe.bin
echo "=== Removing empty directories ==="
rm -rf ./smart-commit-linux ./smart-commit-macos ./smart-commit-windows.exe
echo "=== Renaming files to final names ==="
mv ./smart-commit-linux.bin ./smart-commit-linux
mv ./smart-commit-macos.bin ./smart-commit-macos
mv ./smart-commit-windows.exe.bin ./smart-commit-windows.exe
echo "=== Final directory structure ==="
ls -la
echo "=== Verifying files exist ==="
test -f smart-commit-linux && echo "✅ smart-commit-linux found" || echo "❌ smart-commit-linux missing"
test -f smart-commit-windows.exe && echo "✅ smart-commit-windows.exe found" || echo "❌ smart-commit-windows.exe missing"
test -f smart-commit-macos && echo "✅ smart-commit-macos found" || echo "❌ smart-commit-macos missing"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
smart-commit-linux
smart-commit-windows.exe
smart-commit-macos
generate_release_notes: true
draft: false
prerelease: false
token: ${{ secrets.GH_PAT }}