-
Notifications
You must be signed in to change notification settings - Fork 0
232 lines (198 loc) · 6.76 KB
/
Copy pathrelease.yml
File metadata and controls
232 lines (198 loc) · 6.76 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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
name: Release
# Opt into Node 24 for JS actions (silences the Node 20 deprecation).
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Extract version from tag
id: get_version
shell: bash
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pyinstaller-hooks-contrib
- name: Update settings.json with version
shell: bash
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "{\"CURRENT_VERSION\": \"$TAG\"}" > settings.json
- name: Build executable with PyInstaller
run: pyinstaller RFlect.spec
- name: Verify executable exists
shell: bash
run: |
if [ -f "dist/RFlect.exe" ]; then
echo "Executable built successfully"
ls -lh dist/RFlect.exe
else
echo "Executable not found"
ls -la dist/
exit 1
fi
- name: Build Inno Setup installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
with:
path: installer.iss
options: /DRFLECT_VERSION=${{ steps.get_version.outputs.NUM }}
- name: Verify installer exists
shell: bash
run: |
if ls installer_output/RFlect_Installer_*.exe 1>/dev/null 2>&1; then
echo "Installer built successfully"
ls -lh installer_output/
else
echo "WARNING: Installer build failed, continuing with standalone exe only"
fi
- name: Rename standalone exe
shell: bash
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: cp dist/RFlect.exe "dist/RFlect_${TAG}.exe"
- name: Upload Windows standalone
uses: actions/upload-artifact@v4
with:
name: RFlect-Windows-Standalone
path: dist/RFlect_${{ steps.get_version.outputs.TAG }}.exe
retention-days: 90
- name: Upload Windows installer
uses: actions/upload-artifact@v4
if: ${{ hashFiles('installer_output/RFlect_Installer_*.exe') != '' }}
with:
name: RFlect-Windows-Installer
path: installer_output/RFlect_Installer_*.exe
retention-days: 90
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Extract version from tag
id: get_version
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-tk
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller pyinstaller-hooks-contrib
- name: Update settings.json with version
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "{\"CURRENT_VERSION\": \"$TAG\"}" > settings.json
- name: Build executable with PyInstaller
run: pyinstaller RFlect.spec
- name: Verify executable exists
run: |
if [ -f "dist/RFlect" ]; then
echo "Executable built successfully"
ls -lh dist/RFlect
chmod +x dist/RFlect
else
echo "Executable not found"
ls -la dist/
exit 1
fi
- name: Rename linux binary
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: cp dist/RFlect "dist/RFlect_${TAG}_linux"
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: RFlect-Linux
path: dist/RFlect_${{ steps.get_version.outputs.TAG }}_linux
retention-days: 90
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Extract version from tag
id: get_version
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
echo "NUM=${TAG#v}" >> $GITHUB_OUTPUT
- name: Download Windows standalone
uses: actions/download-artifact@v4
with:
name: RFlect-Windows-Standalone
path: release-assets/
- name: Download Windows installer
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: RFlect-Windows-Installer
path: release-assets/
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: RFlect-Linux
path: release-assets/
- name: List release assets
run: ls -lh release-assets/
- name: Extract release notes for this version
env:
NUM: ${{ steps.get_version.outputs.NUM }}
run: |
# Escape dots for awk regex (4.0.0 -> 4\.0\.0)
ESCAPED=$(echo "$NUM" | sed 's/\./\\./g')
# Extract section: from matching header to next ## Version header
awk "/^## Version ${ESCAPED}/{ found=1; print; next } found && /^## Version /{ exit } found{ print }" RELEASE_NOTES.md > release_body.md
if [ ! -s release_body.md ]; then
echo "## Release v${NUM}" > release_body.md
echo "" >> release_body.md
echo "See [RELEASE_NOTES.md](RELEASE_NOTES.md) for full changelog." >> release_body.md
fi
# Append download guidance
TAG="${{ steps.get_version.outputs.TAG }}"
echo "" >> release_body.md
echo "----" >> release_body.md
echo "### Downloads" >> release_body.md
echo "- **Windows (installer)**: \`RFlect_Installer_${NUM}.exe\` — includes Start Menu shortcut and uninstaller" >> release_body.md
echo "- **Windows (portable)**: \`RFlect_${TAG}.exe\` — standalone, no install required" >> release_body.md
echo "- **Linux**: \`RFlect_${TAG}_linux\` — standalone binary (\`chmod +x\` then run)" >> release_body.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release-assets/*
body_path: release_body.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Notify release complete
env:
TAG: ${{ steps.get_version.outputs.TAG }}
run: |
echo "Release ${TAG} created successfully!"
echo "Download: https://github.com/${{ github.repository }}/releases/tag/${TAG}"