Skip to content

Commit 65a487e

Browse files
committed
[Feature] Add GitHub Actions workflow for automated release process
1 parent 70b841e commit 65a487e

File tree

3 files changed

+248
-38
lines changed

3 files changed

+248
-38
lines changed

.github/workflows/gen-hashs.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
name: Build and Draft Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
prepare:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version: ${{ steps.get_version.outputs.version }}
16+
version_tag: ${{ steps.get_version.outputs.version_tag }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Get version from tag
22+
id: get_version
23+
run: |
24+
VERSION=${GITHUB_REF#refs/tags/v}
25+
echo "version=$VERSION" >> $GITHUB_OUTPUT
26+
echo "version_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
27+
echo "Version: $VERSION"
28+
29+
build:
30+
needs: prepare
31+
strategy:
32+
matrix:
33+
include:
34+
- os: ubuntu-latest
35+
name: linux
36+
archive_cmd: tar -czf
37+
archive_ext: tar.gz
38+
- os: macos-latest
39+
name: macos
40+
archive_cmd: tar -czf
41+
archive_ext: tar.gz
42+
- os: windows-latest
43+
name: windows
44+
archive_cmd: zip -r
45+
archive_ext: zip
46+
runs-on: ${{ matrix.os }}
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Setup build environment (Linux)
53+
if: matrix.os == 'ubuntu-latest'
54+
run: |
55+
sudo apt-get update
56+
sudo apt-get install -y meson ninja-build
57+
58+
- name: Setup build environment (macOS)
59+
if: matrix.os == 'macos-latest'
60+
run: |
61+
brew install meson
62+
63+
- name: Setup build environment (Windows)
64+
if: matrix.os == 'windows-latest'
65+
uses: msys2/setup-msys2@v2
66+
with:
67+
msystem: MINGW64
68+
install: >-
69+
mingw-w64-x86_64-gcc
70+
mingw-w64-x86_64-meson
71+
mingw-w64-x86_64-ninja
72+
mingw-w64-x86_64-pcre2
73+
zip
74+
75+
- name: Build (Linux/macOS)
76+
if: matrix.os != 'windows-latest'
77+
run: |
78+
meson setup builddir --buildtype=release
79+
meson compile -C builddir
80+
meson install -C builddir --destdir=../install
81+
82+
- name: Build (Windows)
83+
if: matrix.os == 'windows-latest'
84+
shell: msys2 {0}
85+
run: |
86+
meson setup builddir --buildtype=release
87+
meson compile -C builddir
88+
meson install -C builddir --destdir=../install
89+
90+
- name: Create archive (Linux/macOS)
91+
if: matrix.os != 'windows-latest'
92+
run: |
93+
cd install
94+
tar -czf ../argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.tar.gz *
95+
96+
- name: Create archive (Windows)
97+
if: matrix.os == 'windows-latest'
98+
shell: msys2 {0}
99+
run: |
100+
cd install
101+
zip -r ../argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.zip *
102+
103+
- name: Generate checksums (Linux)
104+
if: matrix.os == 'ubuntu-latest'
105+
run: |
106+
ARCHIVE_NAME="argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.${{ matrix.archive_ext }}"
107+
sha256sum "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha256"
108+
sha512sum "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha512"
109+
110+
- name: Generate checksums (macOS)
111+
if: matrix.os == 'macos-latest'
112+
run: |
113+
ARCHIVE_NAME="argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.${{ matrix.archive_ext }}"
114+
shasum -a 256 "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha256"
115+
shasum -a 512 "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha512"
116+
117+
- name: Generate checksums (Windows)
118+
if: matrix.os == 'windows-latest'
119+
shell: msys2 {0}
120+
run: |
121+
ARCHIVE_NAME="argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.${{ matrix.archive_ext }}"
122+
sha256sum "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha256"
123+
sha512sum "$ARCHIVE_NAME" > "$ARCHIVE_NAME.sha512"
124+
125+
- name: Upload build artifact
126+
uses: actions/upload-artifact@v4
127+
with:
128+
name: argus-${{ matrix.name }}
129+
path: argus-${{ needs.prepare.outputs.version }}-bin-${{ matrix.name }}.${{ matrix.archive_ext }}
130+
retention-days: 90
131+
132+
source-archive:
133+
needs: prepare
134+
runs-on: ubuntu-latest
135+
steps:
136+
- name: Checkout
137+
uses: actions/checkout@v4
138+
139+
- name: Setup build environment
140+
run: |
141+
sudo apt-get update
142+
sudo apt-get install -y meson ninja-build
143+
144+
- name: Create source archive
145+
run: |
146+
meson setup builddir
147+
meson dist -C builddir --no-tests --formats=gztar
148+
cp builddir/meson-dist/*.tar.gz argus-${{ needs.prepare.outputs.version }}-source.tar.gz
149+
# Create zip version from tar.gz
150+
tar -xzf argus-${{ needs.prepare.outputs.version }}-source.tar.gz
151+
zip -r argus-${{ needs.prepare.outputs.version }}-source.zip argus-${{ needs.prepare.outputs.version }}/
152+
153+
- name: Generate source checksums
154+
run: |
155+
sha256sum argus-${{ needs.prepare.outputs.version }}-source.tar.gz > argus-${{ needs.prepare.outputs.version }}-source.tar.gz.sha256
156+
sha512sum argus-${{ needs.prepare.outputs.version }}-source.tar.gz > argus-${{ needs.prepare.outputs.version }}-source.tar.gz.sha512
157+
sha256sum argus-${{ needs.prepare.outputs.version }}-source.zip > argus-${{ needs.prepare.outputs.version }}-source.zip.sha256
158+
sha512sum argus-${{ needs.prepare.outputs.version }}-source.zip > argus-${{ needs.prepare.outputs.version }}-source.zip.sha512
159+
160+
- name: Upload source artifact
161+
uses: actions/upload-artifact@v4
162+
with:
163+
name: argus-source
164+
path: |
165+
argus-${{ needs.prepare.outputs.version }}-source.tar.gz
166+
argus-${{ needs.prepare.outputs.version }}-source.zip
167+
retention-days: 90
168+
169+
create-draft-release:
170+
needs: [prepare, build, source-archive]
171+
runs-on: ubuntu-latest
172+
steps:
173+
- name: Checkout
174+
uses: actions/checkout@v4
175+
176+
- name: Download all artifacts
177+
uses: actions/download-artifact@v4
178+
with:
179+
path: release-artifacts/
180+
181+
- name: Prepare release files
182+
run: |
183+
mkdir -p final-artifacts
184+
find release-artifacts/ -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.tar.xz" \) -exec cp {} final-artifacts/ \;
185+
echo "Files to release:"
186+
ls -la final-artifacts/
187+
188+
- name: Create consolidated checksums
189+
run: |
190+
echo "# Argus Release ${{ needs.prepare.outputs.version }} - Checksums" > final-artifacts/CHECKSUMS.txt
191+
echo "Generated on: $(date -u)" >> final-artifacts/CHECKSUMS.txt
192+
echo "" >> final-artifacts/CHECKSUMS.txt
193+
echo "## SHA256" >> final-artifacts/CHECKSUMS.txt
194+
find release-artifacts/ -name "*.sha256" -exec cat {} \; >> final-artifacts/CHECKSUMS.txt
195+
echo "" >> final-artifacts/CHECKSUMS.txt
196+
echo "## SHA512" >> final-artifacts/CHECKSUMS.txt
197+
find release-artifacts/ -name "*.sha512" -exec cat {} \; >> final-artifacts/CHECKSUMS.txt
198+
echo "" >> final-artifacts/CHECKSUMS.txt
199+
echo "Verify SHA256: sha256sum -c <(grep -A999 '## SHA256' CHECKSUMS.txt | tail -n +2 | grep -v '^## ')" >> final-artifacts/CHECKSUMS.txt
200+
echo "Verify SHA512: sha512sum -c <(grep -A999 '## SHA512' CHECKSUMS.txt | tail -n +2 | grep -v '^## ')" >> final-artifacts/CHECKSUMS.txt
201+
202+
- name: Generate release notes
203+
id: release_notes
204+
run: |
205+
echo "## 🚀 Release ${{ needs.prepare.outputs.version_tag }}" > release_notes.md
206+
echo "" >> release_notes.md
207+
echo "### 📝 Changes" >> release_notes.md
208+
echo "" >> release_notes.md
209+
echo "<!-- Please edit this draft to add release notes -->" >> release_notes.md
210+
echo "- Add your changes here" >> release_notes.md
211+
echo "" >> release_notes.md
212+
echo "### 📦 Which archive to download?" >> release_notes.md
213+
echo "" >> release_notes.md
214+
echo "- **Binary packages**: Ready-to-use compiled libraries (Linux/macOS/Windows)" >> release_notes.md
215+
echo "- **argus-\*-source.\*** archives**: Clean source distribution for compilation (use these for building from source)" >> release_notes.md
216+
echo "- **Source code** links: Raw repository snapshot (contains development files)" >> release_notes.md
217+
echo "" >> release_notes.md
218+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ needs.prepare.outputs.version }}...HEAD" >> release_notes.md
219+
220+
- name: Create Draft Release
221+
uses: softprops/action-gh-release@v2
222+
with:
223+
tag_name: ${{ needs.prepare.outputs.version_tag }}
224+
name: "Release ${{ needs.prepare.outputs.version }}"
225+
body_path: release_notes.md
226+
files: final-artifacts/*
227+
draft: true
228+
prerelease: false
229+
generate_release_notes: false
230+
env:
231+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
232+
233+
- name: Summary
234+
run: |
235+
echo "## ✅ Draft Release Created!" >> $GITHUB_STEP_SUMMARY
236+
echo "" >> $GITHUB_STEP_SUMMARY
237+
echo "🎯 **Tag**: ${{ needs.prepare.outputs.version_tag }}" >> $GITHUB_STEP_SUMMARY
238+
echo "📦 **Artifacts**: $(ls final-artifacts/ | wc -l) files" >> $GITHUB_STEP_SUMMARY
239+
echo "" >> $GITHUB_STEP_SUMMARY
240+
echo "👉 [View Draft Release](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY
241+
echo "" >> $GITHUB_STEP_SUMMARY
242+
echo "**Next steps:**" >> $GITHUB_STEP_SUMMARY
243+
echo "1. Review the draft release" >> $GITHUB_STEP_SUMMARY
244+
echo "2. Edit release notes" >> $GITHUB_STEP_SUMMARY
245+
echo "3. Test the artifacts" >> $GITHUB_STEP_SUMMARY
246+
echo "4. Publish when ready"

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Module.symvers
5151
Mkfile.old
5252
dkms.conf
5353

54-
.build/
54+
.build*/
5555
build/
5656
buildir/
5757
.vscode/
@@ -61,6 +61,7 @@ reports/
6161
.venv/
6262
packaging/conan/test_package/build/
6363
packaging/conan/test_package/CMakeUserPresets.json
64+
.claude/
6465
*.pyc
6566
.mypy_cache
6667
subprojects/packagecache/

0 commit comments

Comments
 (0)