@@ -2,19 +2,25 @@ name: Build and Publish to NuGet
22
33on :
44 push :
5+ tags :
6+ - ' v*.*.*'
57 branches : [ master, main ]
68 paths :
79 - ' src/Base58Encoding/**'
810 - ' !src/Base58Encoding.Tests/**'
911 - ' !src/Base58Encoding.Benchmarks/**'
10- tags :
11- - ' v*.*.*'
1212 pull_request :
1313 branches : [ master, main ]
1414 paths :
1515 - ' src/Base58Encoding/**'
1616 - ' !src/Base58Encoding.Tests/**'
1717 - ' !src/Base58Encoding.Benchmarks/**'
18+ workflow_dispatch :
19+ inputs :
20+ version :
21+ description : ' Package version (e.g., 1.0.0)'
22+ required : false
23+ type : string
1824
1925jobs :
2026 build :
2632 - name : Get version from tag
2733 if : startsWith(github.ref, 'refs/tags/v')
2834 run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
35+
36+ - name : Get version from input
37+ if : github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
38+ run : echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
2939
3040 - name : Setup .NET
3141 uses : actions/setup-dotnet@v4
@@ -41,12 +51,12 @@ jobs:
4151 - name : Test
4252 run : dotnet test src/Base58Encoding.Tests/Base58Encoding.Tests.csproj --configuration Release --no-build --verbosity normal
4353
44- - name : Pack (with version from tag )
45- if : startsWith(github.ref, 'refs/tags/v')
54+ - name : Pack (with version)
55+ if : env.VERSION != ''
4656 run : dotnet pack src/Base58Encoding/Base58Encoding.csproj --configuration Release --no-build --output ./artifacts -p:PackageVersion=${{ env.VERSION }}
4757
4858 - name : Pack (without version)
49- if : " !startsWith(github.ref, 'refs/tags/v') "
59+ if : env.VERSION == ''
5060 run : dotnet pack src/Base58Encoding/Base58Encoding.csproj --configuration Release --no-build --output ./artifacts
5161
5262 - name : Upload artifacts
0 commit comments