11name : .NET build and test
22env :
3+ CURRENT_VERSION : 1.0.${{ github.run_number }}
34 LAST_COMMIT_MESSAGE : ${{ github.event.head_commit.message }}
45
56on :
@@ -27,10 +28,12 @@ jobs:
2728 - name : " Build & test"
2829 run : |
2930 echo "done!"
31+ git tag ${{ env.CURRENT_VERSION }}
32+ git push origin --tags
3033 pwd
3134
32- deployMain :
33- if : github.ref = = 'refs/heads/main'
35+ deployPreRelease :
36+ if : github.ref ! = 'refs/heads/main'
3437 runs-on : ubuntu-latest
3538 needs : build
3639 steps :
@@ -49,22 +52,21 @@ jobs:
4952 run : |
5053 ls ./GithubActionsHelloWorld/bin/Release
5154 dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
52- # dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
5355 - uses : papeloto/action-zip@v1
5456 with :
5557 files : ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
5658 dest : GithubActionsHelloWorld.zip
5759 - uses : " marvinpinto/action-automatic-releases@latest"
5860 with :
5961 repo_token : " ${{ secrets.GITHUB_TOKEN }}"
60- automatic_release_tag : " latest "
61- title : " Release Build "
62+ automatic_release_tag : ${{ env.CURRENT_VERSION }}
63+ prerelease : true
6264 files : |
6365 LICENSE
6466 GithubActionsHelloWorld.zip
6567
66- deployTest :
67- if : github.ref ! = 'refs/heads/main'
68+ deployRelease :
69+ if : github.ref = = 'refs/heads/main'
6870 runs-on : ubuntu-latest
6971 needs : build
7072 steps :
@@ -83,16 +85,17 @@ jobs:
8385 run : |
8486 ls ./GithubActionsHelloWorld/bin/Release
8587 dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
88+ # dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
8689 - uses : papeloto/action-zip@v1
8790 with :
8891 files : ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
8992 dest : GithubActionsHelloWorld.zip
9093 - uses : " marvinpinto/action-automatic-releases@latest"
9194 with :
9295 repo_token : " ${{ secrets.GITHUB_TOKEN }}"
93- automatic_release_tag : " latest-prerelease"
94- prerelease : true
95- title : " Prerelease Build"
96+ automatic_release_tag : ${{ env.CURRENT_VERSION }}
9697 files : |
9798 LICENSE
9899 GithubActionsHelloWorld.zip
100+
101+
0 commit comments