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
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
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
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
0 commit comments