Skip to content

Commit 649dc22

Browse files
Update release.yml
1 parent 94efe00 commit 649dc22

File tree

1 file changed

+37
-23
lines changed

1 file changed

+37
-23
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Release PyElevate
1+
name: Build & Release PyElevate
22

33
on:
44
workflow_dispatch:
@@ -33,49 +33,44 @@ jobs:
3333
include:
3434
- os: ubuntu-latest
3535
target: x86_64-unknown-linux-gnu
36-
bin: pyelevate
3736
osname: linux
38-
ext: ""
39-
pack: tar
40-
4137
- os: windows-latest
4238
target: x86_64-pc-windows-msvc
43-
bin: pyelevate.exe
4439
osname: windows
45-
ext: ".exe"
46-
pack: zip
47-
4840
- os: macos-latest
4941
target: aarch64-apple-darwin
50-
bin: pyelevate
5142
osname: macos-arm64
52-
ext: ""
53-
pack: tar
5443

5544
runs-on: ${{ matrix.os }}
5645

5746
steps:
5847
- uses: actions/checkout@v4
48+
5949
- uses: dtolnay/rust-toolchain@stable
6050
- uses: Swatinem/rust-cache@v2
6151

6252
- run: rustup target add ${{ matrix.target }}
6353
- run: cargo build --release --target ${{ matrix.target }}
6454

65-
- name: Package binary (flat archive)
55+
- name: Package Binary
6656
shell: bash
6757
run: |
68-
NAME=pyelevate-v${{ needs.version.outputs.version }}-${{ matrix.osname }}
69-
mkdir pkg
70-
cp target/${{ matrix.target }}/release/${{ matrix.bin }} pkg/pyelevate${{ matrix.ext }}
71-
cd pkg
72-
if [ "${{ matrix.pack }}" = "zip" ]; then
73-
zip -9 ../$NAME.zip pyelevate${{ matrix.ext }}
58+
VERSION=${{ needs.version.outputs.version }}
59+
BIN=pyelevate
60+
EXT=""
61+
if [ "${{ runner.os }}" = "Windows" ]; then EXT=".exe"; fi
62+
NAME=pyelevate-v${VERSION}-${{ matrix.osname }}
63+
64+
mkdir -p pkg
65+
cp target/${{ matrix.target }}/release/$BIN$EXT pkg/
66+
67+
if [ "${{ runner.os }}" = "Windows" ]; then
68+
powershell Compress-Archive -Path pkg\$BIN$EXT -DestinationPath $NAME.zip
69+
certutil -hashfile $NAME.zip SHA256 | head -1 > $NAME.sha256
7470
else
75-
tar -cJf ../$NAME.tar.xz pyelevate${{ matrix.ext }}
71+
tar -cJf $NAME.tar.xz -C pkg $BIN$EXT
72+
shasum -a 256 $NAME.tar.xz > $NAME.sha256
7673
fi
77-
cd ..
78-
sha256sum $NAME.* > $NAME.sha256
7974
8075
- uses: actions/upload-artifact@v4
8176
with:
@@ -85,9 +80,27 @@ jobs:
8580
*.tar.xz
8681
*.sha256
8782
83+
changelog:
84+
needs: version
85+
runs-on: ubuntu-latest
86+
outputs:
87+
notes: ${{ steps.cliff.outputs.content }}
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- name: Generate Changelog with git-cliff
92+
id: cliff
93+
uses: orhun/git-cliff-action@v3
94+
with:
95+
config: cliff.toml
96+
args: --latest --strip header
97+
env:
98+
OUTPUT: CHANGELOG_GENERATED.md
99+
88100
release:
89-
needs: [version, build]
101+
needs: [version, build, changelog]
90102
runs-on: ubuntu-latest
103+
91104
steps:
92105
- uses: actions/download-artifact@v4
93106
with:
@@ -97,6 +110,7 @@ jobs:
97110
with:
98111
tag_name: v${{ needs.version.outputs.version }}
99112
name: PyElevate v${{ needs.version.outputs.version }}
113+
body: ${{ needs.changelog.outputs.notes }}
100114
files: artifacts/**/*
101115
env:
102116
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)