1- name : Build & Release PyElevate
1+ name : Build and Release App
22
33on :
44 workflow_dispatch :
@@ -10,10 +10,6 @@ concurrency:
1010 group : release-${{ github.ref }}
1111 cancel-in-progress : true
1212
13- env :
14- CARGO_TERM_COLOR : always
15- RUST_BACKTRACE : 1
16-
1713jobs :
1814 version :
1915 runs-on : ubuntu-latest
@@ -33,13 +29,22 @@ jobs:
3329 include :
3430 - os : ubuntu-latest
3531 target : x86_64-unknown-linux-gnu
32+ bin : pyelevate
3633 osname : linux
34+ ext : " "
35+ pack : tar
3736 - os : windows-latest
3837 target : x86_64-pc-windows-msvc
38+ bin : pyelevate.exe
3939 osname : windows
40+ ext : " .exe"
41+ pack : zip
4042 - os : macos-latest
4143 target : aarch64-apple-darwin
44+ bin : pyelevate
4245 osname : macos-arm64
46+ ext : " "
47+ pack : tar
4348
4449 runs-on : ${{ matrix.os }}
4550
@@ -51,26 +56,25 @@ jobs:
5156 - run : rustup target add ${{ matrix.target }}
5257 - run : cargo build --release --target ${{ matrix.target }}
5358
54- - name : Package Binary
59+ - name : Ensure zip exists (Windows)
60+ if : matrix.os == 'windows-latest'
61+ run : choco install zip -y
62+
63+ - name : Package
5564 shell : bash
5665 run : |
57- VERSION=${{ needs.version.outputs.version }}
58- BIN=pyelevate
59- EXT=""
60- if [ "${{ runner.os }}" = "Windows" ]; then EXT=".exe"; fi
61- NAME=pyelevate-v${VERSION}-${{ matrix.osname }}
62-
63- mkdir -p pkg
64- cp target/${{ matrix.target }}/release/$BIN$EXT pkg/
65-
66- if [ "${{ runner.os }}" = "Windows" ]; then
67- powershell Compress-Archive -Path pkg\$BIN$EXT -DestinationPath $NAME.zip
68- certutil -hashfile $NAME.zip SHA256 | head -1 > $NAME.sha256
66+ NAME=pyelevate-v${{ needs.version.outputs.version }}-${{ matrix.osname }}
67+ mkdir pkg
68+ cp target/${{ matrix.target }}/release/${{ matrix.bin }} pkg/pyelevate${{ matrix.ext }}
69+
70+ if [ "${{ matrix.pack }}" = "zip" ]; then
71+ cd pkg && zip -9 ../$NAME.zip *
6972 else
70- tar -cJf $NAME.tar.xz -C pkg $BIN$EXT
71- shasum -a 256 $NAME.tar.xz > $NAME.sha256
73+ tar -C pkg -cJf $NAME.tar.xz .
7274 fi
7375
76+ sha256sum $NAME.* > $NAME.sha256
77+
7478 - uses : actions/upload-artifact@v4
7579 with :
7680 name : ${{ matrix.osname }}
@@ -79,45 +83,35 @@ jobs:
7983 *.tar.xz
8084 *.sha256
8185
82- changelog :
83- needs : version
86+ release :
87+ needs : [ version, build]
8488 runs-on : ubuntu-latest
85- outputs :
86- notes : ${{ steps.cliff.outputs.notes }}
8789
8890 steps :
8991 - uses : actions/checkout@v4
9092 with :
9193 fetch-depth : 0
9294
93- - name : Install git-cliff (native, no Docker)
94- run : |
95- curl -sL https://github.com/orhun/git-cliff/releases/latest/download/git-cliff-x86_64-unknown-linux-gnu.tar.gz \
96- | tar -xz
97- sudo mv git-cliff /usr/local/bin/
98-
99- - name : Generate changelog
100- id : cliff
101- run : |
102- git-cliff --config cliff.toml --latest --strip header > CHANGELOG_GENERATED.md
103- echo "notes<<EOF" >> $GITHUB_OUTPUT
104- cat CHANGELOG_GENERATED.md >> $GITHUB_OUTPUT
105- echo "EOF" >> $GITHUB_OUTPUT
106-
107- release :
108- needs : [version, build, changelog]
109- runs-on : ubuntu-latest
110-
111- steps :
11295 - uses : actions/download-artifact@v4
11396 with :
11497 path : artifacts
11598
99+ - name : Install git-cliff (official binary)
100+ run : |
101+ VERSION=$(gh release view --repo orhun/git-cliff --json tagName -q .tagName)
102+ curl -sL "https://github.com/orhun/git-cliff/releases/download/${VERSION}/git-cliff-${VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz
103+ sudo mv git-cliff /usr/local/bin/
104+ env :
105+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106+
107+ - name : Generate Changelog
108+ run : git-cliff -o CHANGELOG.md
109+
116110 - uses : softprops/action-gh-release@v2
117111 with :
118112 tag_name : v${{ needs.version.outputs.version }}
119113 name : PyElevate v${{ needs.version.outputs.version }}
120- body : ${{ needs.changelog.outputs.notes }}
114+ body_path : CHANGELOG.md
121115 files : artifacts/**/*
122116 env :
123117 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments