Skip to content

Commit 7bf2168

Browse files
committed
Add GitHub Actions workflow for automated build and release
1 parent 4b9886f commit 7bf2168

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup .NET 10
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '10.0.x'
21+
22+
- name: Extract Version
23+
id: get_version
24+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
25+
26+
- name: Publish (Linux x64)
27+
run: |
28+
dotnet publish src/git_heatmap_generator/git_heatmap_generator.csproj -c Release -r linux-x64 --self-contained true \
29+
-p:PublishSingleFile=true -p:AssemblyName=git-heatmap-generator \
30+
-p:Version=${{ steps.get_version.outputs.VERSION }} \
31+
-o ./publish/linux
32+
33+
- name: Publish (Windows x64)
34+
run: |
35+
dotnet publish src/git_heatmap_generator/git_heatmap_generator.csproj -c Release -r win-x64 --self-contained true \
36+
-p:PublishSingleFile=true -p:AssemblyName=git-heatmap-generator \
37+
-p:Version=${{ steps.get_version.outputs.VERSION }} \
38+
-o ./publish/windows
39+
40+
- name: Publish (macOS ARM64)
41+
run: |
42+
dotnet publish src/git_heatmap_generator/git_heatmap_generator.csproj -c Release -r osx-arm64 --self-contained true \
43+
-p:PublishSingleFile=true -p:AssemblyName=git-heatmap-generator \
44+
-p:Version=${{ steps.get_version.outputs.VERSION }} \
45+
-o ./publish/macos-arm
46+
47+
- name: Zip Artifacts with App Name and Tag
48+
run: |
49+
zip -j "git-heatmap-generator-${{ github.ref_name }}-linux-x64.zip" ./publish/linux/*
50+
zip -j "git-heatmap-generator-${{ github.ref_name }}-win-x64.zip" ./publish/windows/*
51+
zip -j "git-heatmap-generator-${{ github.ref_name }}-osx-arm64.zip" ./publish/macos-arm/*
52+
53+
- name: Create GitHub Release
54+
uses: softprops/action-gh-release@v2
55+
with:
56+
files: |
57+
git-heatmap-generator-${{ github.ref_name }}-linux-x64.zip
58+
git-heatmap-generator-${{ github.ref_name }}-win-x64.zip
59+
git-heatmap-generator-${{ github.ref_name }}-osx-arm64.zip
60+
generate_release_notes: true

0 commit comments

Comments
 (0)