1- name : Build NotepadAI
1+ name : Build & Release NotepadAI
22
33on :
44 workflow_dispatch :
55 push :
6- # branches:
7- # - master
8- tags :
9- - ' *'
10- # pull_request:
6+ branches :
7+ - master
8+
9+ concurrency :
10+ group : release
11+ cancel-in-progress : false
1112
1213env :
13- QT_RELEASE_VER : 6.5
14+ QT_VERSION : " 6.8 "
1415
1516jobs :
17+ version :
18+ name : Determine Version
19+ runs-on : ubuntu-latest
20+ outputs :
21+ version : ${{ steps.bump.outputs.version }}
22+ tag : ${{ steps.bump.outputs.tag }}
23+ steps :
24+ - name : Checkout Repository
25+ uses : actions/checkout@v6
26+ with :
27+ fetch-depth : 0
28+
29+ - name : Bump patch version
30+ id : bump
31+ run : |
32+ # Find latest v0.0.* tag
33+ LATEST=$(git tag -l 'v0.0.*' --sort=-v:refname | head -1)
34+ if [ -z "$LATEST" ]; then
35+ # No v0.0.x tags exist yet — start from v0.0.1
36+ NEW_PATCH=1
37+ else
38+ PATCH="${LATEST##*.}"
39+ NEW_PATCH=$((PATCH + 1))
40+ fi
41+ VERSION="0.0.${NEW_PATCH}"
42+ TAG="v${VERSION}"
43+ echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
44+ echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
45+ echo "Next version: ${TAG}"
46+
1647 build :
48+ needs : [version]
1749 strategy :
1850 fail-fast : false
1951 matrix :
2052 os : [ubuntu-24.04, windows-2022, macos-latest]
21- qt_version : ["6.5", "6.8", "6.10"]
2253
2354 runs-on : ${{ matrix.os }}
2455
2556 steps :
2657 - name : Checkout Repository
2758 uses : actions/checkout@v6
2859
29- - name : Sync VERSION to tag
30- if : startsWith(github.ref, 'refs/tags/v')
60+ - name : Set VERSION in CMakeLists.txt
3161 shell : bash
3262 run : |
33- VER="${GITHUB_REF_NAME#v }"
63+ VER="${{ needs.version.outputs.version } }"
3464 if [[ "$OSTYPE" == darwin* ]]; then
3565 sed -i '' 's/^\([[:space:]]*VERSION[[:space:]]*\).*/\1'"$VER"'/' CMakeLists.txt
3666 else
4171 - name : Install Qt
4272 uses : jurplel/install-qt-action@v4
4373 with :
44- version : ${{ matrix.qt_version }}
74+ version : ${{ env.QT_VERSION }}
4575 modules : ' qt5compat'
4676 cache : true
4777
@@ -71,14 +101,7 @@ jobs:
71101 if : runner.os == 'Linux'
72102 run : |
73103 echo "DISTRIBUTION=AppImage" >> "$GITHUB_ENV"
74-
75- # Qt 6.10+ renamed wayland plugins
76- if [[ "${{ matrix.qt_version }}" == "6.10" ]]; then
77- echo "EXTRA_PLATFORM_PLUGINS=libqwayland.so" >> "$GITHUB_ENV"
78- else
79- echo "EXTRA_PLATFORM_PLUGINS=libqwayland-generic.so" >> "$GITHUB_ENV"
80- fi
81-
104+ echo "EXTRA_PLATFORM_PLUGINS=libqwayland-generic.so" >> "$GITHUB_ENV"
82105 sudo apt-get install libxkbcommon-dev libxkbcommon-x11-0 fuse libxcb-cursor-dev libcups2-dev
83106
84107 - name : Configure
@@ -103,36 +126,34 @@ jobs:
103126 uses : actions/upload-artifact@v6
104127 if : runner.os == 'Windows'
105128 with :
106- name : NotepadAI-Windows-Qt${{ matrix.qt_version }}- Zip
129+ name : NotepadAI-Windows-Zip
107130 path : ${{ github.workspace }}/build/package/
108131
109132 - name : Upload Windows Installer
110133 uses : actions/upload-artifact@v6
111134 if : runner.os == 'Windows'
112135 with :
113- name : NotepadAI-Windows-Qt${{ matrix.qt_version }}- Installer
136+ name : NotepadAI-Windows-Installer
114137 path : ${{ github.workspace }}/installer/NotepadAI*.exe
115138
116139 - name : Upload MacOS dmg
117140 uses : actions/upload-artifact@v6
118141 if : runner.os == 'macOS'
119142 with :
120- name : NotepadAI-macOS-Qt${{ matrix.qt_version }}
143+ name : NotepadAI-macOS
121144 path : ${{ github.workspace }}/build/NotepadAI*.dmg
122145
123146 - name : Upload Linux AppImage
124147 uses : actions/upload-artifact@v6
125148 if : runner.os == 'Linux'
126149 with :
127- name : NotepadAI-Linux-Qt${{ matrix.qt_version }}- AppImage
150+ name : NotepadAI-Linux-AppImage
128151 path : ${{ github.workspace }}/build/NotepadAI*.AppImage
129152
130- github :
131- name : Draft GitHub Release
153+ release :
154+ name : Publish GitHub Release
132155 runs-on : ubuntu-latest
133- needs : [build]
134-
135- if : github.repository == 'nullmastermind/NotepadAI' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
156+ needs : [version, build]
136157 permissions :
137158 contents : write
138159 env :
@@ -141,30 +162,43 @@ jobs:
141162 steps :
142163 - name : Checkout Repository
143164 uses : actions/checkout@v6
165+ with :
166+ fetch-depth : 0
167+
168+ - name : Create and push tag
169+ run : |
170+ git config user.email "action@github.com"
171+ git config user.name "GitHub Action"
172+ git tag ${{ needs.version.outputs.tag }}
173+ git push origin ${{ needs.version.outputs.tag }}
144174
145- - name : Create Draft Release
175+ - name : Create Release
146176 run : |
147- gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes --draft
177+ gh release create ${{ needs.version.outputs.tag }} \
178+ --title "${{ needs.version.outputs.tag }}" \
179+ --generate-notes
148180
149181 - name : Download all artifacts
150182 uses : actions/download-artifact@v7
151183
152184 - name : Upload Windows Installer
153185 run : |
154- gh release upload ${{ github.ref_name }} NotepadAI-Windows-Qt$QT_RELEASE_VER-Installer/NotepadAI-${{ github.ref_name }}-Installer.exe
186+ mv NotepadAI-Windows-Installer/NotepadAI*.exe "NotepadAI-${{ needs.version.outputs.tag }}-Installer.exe"
187+ gh release upload ${{ needs.version.outputs.tag }} "NotepadAI-${{ needs.version.outputs.tag }}-Installer.exe"
155188
156- # The artifact is unzipped, so need to zip it back up so it can be uploaded
157189 - name : Upload Windows Zip
158190 run : |
159- cd NotepadAI-Windows-Qt$QT_RELEASE_VER- Zip/
160- zip -r ../NotepadAI-${{ github.ref_name }}-win64.zip .
191+ cd NotepadAI-Windows-Zip/
192+ zip -r " ../NotepadAI-${{ needs.version.outputs.tag }}-win64.zip" .
161193 cd ..
162- gh release upload ${{ github.ref_name }} NotepadAI-${{ github.ref_name }}-win64.zip
194+ gh release upload ${{ needs.version.outputs.tag }} " NotepadAI-${{ needs.version.outputs.tag }}-win64.zip"
163195
164196 - name : Upload Linux AppImage
165197 run : |
166- gh release upload ${{ github.ref_name }} NotepadAI-Linux-Qt$QT_RELEASE_VER-AppImage/NotepadAI-${{ github.ref_name }}-x86_64.AppImage
198+ mv NotepadAI-Linux-AppImage/NotepadAI*.AppImage "NotepadAI-${{ needs.version.outputs.tag }}-x86_64.AppImage"
199+ gh release upload ${{ needs.version.outputs.tag }} "NotepadAI-${{ needs.version.outputs.tag }}-x86_64.AppImage"
167200
168- - name : Upload macOS App
201+ - name : Upload macOS dmg
169202 run : |
170- gh release upload ${{ github.ref_name }} NotepadAI-macOS-Qt$QT_RELEASE_VER/NotepadAI-${{ github.ref_name }}.dmg
203+ mv NotepadAI-macOS/NotepadAI*.dmg "NotepadAI-${{ needs.version.outputs.tag }}.dmg"
204+ gh release upload ${{ needs.version.outputs.tag }} "NotepadAI-${{ needs.version.outputs.tag }}.dmg"
0 commit comments