Skip to content

Commit cb8c715

Browse files
committed
Add automated GitHub release workflow
1 parent 632256c commit cb8c715

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: release-${{ github.ref }}
13+
cancel-in-progress: false
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Check out source
21+
uses: actions/checkout@v4
22+
23+
- name: Set up .NET 10
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: "10.0.x"
27+
28+
- name: Validate tag matches project version
29+
shell: bash
30+
run: |
31+
project_version="$(grep -oPm1 '(?<=<Version>)[^<]+' DecompilerServer.csproj)"
32+
tag_version="${GITHUB_REF_NAME#v}"
33+
34+
if [[ -z "$project_version" ]]; then
35+
echo "Could not read <Version> from DecompilerServer.csproj"
36+
exit 1
37+
fi
38+
39+
if [[ "$project_version" != "$tag_version" ]]; then
40+
echo "Tag version '$tag_version' does not match project version '$project_version'"
41+
exit 1
42+
fi
43+
44+
- name: Build release
45+
run: dotnet build DecompilerServer.sln -c Release
46+
47+
- name: Run tests
48+
run: dotnet test Tests/Tests.csproj -c Release --no-build
49+
50+
- name: Publish release output
51+
run: dotnet publish DecompilerServer.csproj -c Release -o out/publish --no-build
52+
53+
- name: Package release artifacts
54+
shell: bash
55+
run: |
56+
asset_base="DecompilerServer-${GITHUB_REF_NAME}"
57+
tarball="${asset_base}.tar.gz"
58+
zipfile="${asset_base}.zip"
59+
60+
tar -C out -czf "$tarball" publish
61+
(cd out && zip -qr "../$zipfile" publish)
62+
63+
sha256sum "$tarball" > "${tarball}.sha256"
64+
sha256sum "$zipfile" > "${zipfile}.sha256"
65+
66+
- name: Create GitHub release
67+
uses: softprops/action-gh-release@v2
68+
with:
69+
files: |
70+
DecompilerServer-${{ github.ref_name }}.tar.gz
71+
DecompilerServer-${{ github.ref_name }}.tar.gz.sha256
72+
DecompilerServer-${{ github.ref_name }}.zip
73+
DecompilerServer-${{ github.ref_name }}.zip.sha256
74+
generate_release_notes: true
75+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)