Skip to content

Commit 3f209eb

Browse files
authored
ci: publish with git tag version (#14)
1 parent c6f8d26 commit 3f209eb

2 files changed

Lines changed: 26 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ jobs:
3131

3232
steps:
3333
- uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Get version from tag
38+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
39+
shell: bash
3440

3541
- name: Setup .NET
3642
uses: actions/setup-dotnet@v4
@@ -40,14 +46,14 @@ jobs:
4046
- name: Restore dependencies
4147
run: dotnet restore
4248

43-
- name: Build
44-
run: dotnet build --configuration Release --no-restore
49+
- name: Build with version from tag
50+
run: dotnet build src/hyprwt.csproj --configuration Release --no-restore -p:Version=${{ env.VERSION }}
4551

4652
- name: Test
4753
run: dotnet test --no-restore --verbosity normal
4854

49-
- name: Publish binary
50-
run: dotnet publish src/hyprwt.csproj --configuration Release --runtime ${{ matrix.rid }} --self-contained true --output ./publish/${{ matrix.name }}
55+
- name: Publish binary with version
56+
run: dotnet publish src/hyprwt.csproj --configuration Release --runtime ${{ matrix.rid }} --self-contained true --output ./publish/${{ matrix.name }} -p:Version=${{ env.VERSION }}
5157

5258
- name: Upload artifacts
5359
uses: actions/upload-artifact@v4
@@ -60,6 +66,12 @@ jobs:
6066

6167
steps:
6268
- uses: actions/checkout@v4
69+
with:
70+
fetch-depth: 0
71+
72+
- name: Get version from tag
73+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
74+
shell: bash
6375

6476
- name: Setup .NET
6577
uses: actions/setup-dotnet@v4
@@ -69,8 +81,8 @@ jobs:
6981
- name: Restore dependencies
7082
run: dotnet restore
7183

72-
- name: Pack dotnet tool
73-
run: dotnet pack src/hyprwt.csproj --configuration Release --output ./nupkg
84+
- name: Pack dotnet tool with version from tag
85+
run: dotnet pack src/hyprwt.csproj --configuration Release --output ./nupkg -p:Version=${{ env.VERSION }}
7486

7587
- name: Upload dotnet tool package
7688
uses: actions/upload-artifact@v4
@@ -84,6 +96,12 @@ jobs:
8496

8597
steps:
8698
- uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0
101+
102+
- name: Get version from tag
103+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
104+
shell: bash
87105

88106
- name: Download all artifacts
89107
uses: actions/download-artifact@v4
@@ -102,6 +120,8 @@ jobs:
102120
- name: Create GitHub Release
103121
uses: softprops/action-gh-release@v2
104122
with:
123+
tag_name: v${{ env.VERSION }}
124+
name: Release v${{ env.VERSION }}
105125
files: |
106126
artifacts/*.tar.gz
107127
artifacts/dotnet-tool/*.nupkg

src/hyprwt.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
<!-- Assembly Info -->
99
<AssemblyName>hyprwt</AssemblyName>
10-
<Version>0.1.0</Version>
1110
<Authors>Stephan van Stekelenburg</Authors>
1211
<Description>Customizable git worktree manager</Description>
1312
<Copyright>Copyright © 2025</Copyright>

0 commit comments

Comments
 (0)