Skip to content

Commit cc360d9

Browse files
authored
Merge e65a1f4 into 1b5c204
2 parents 1b5c204 + e65a1f4 commit cc360d9

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.github/workflows/dotnet.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: .NET build and test
22
env:
3+
CURRENT_VERSION: 1.0.${{ github.run_number }}
34
LAST_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
45

56
on:
@@ -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+

GithubActionsHelloWorld/GithubActionsHelloWorld.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>net6.0</TargetFramework>
6-
<Version Condition="'$(GITHUB_RUN_NUMBER)' != ''">1.0.$(GITHUB_RUN_NUMBER)</Version>
7-
<Version Condition="'$(GITHUB_RUN_NUMBER)' == ''">0.0.1</Version>
6+
<Version Condition="'$(CURRENT_VERSION)' != ''">$(CURRENT_VERSION)</Version>
7+
<Version Condition="'$(CURRENT_VERSION)' == ''">0.0.1</Version>
88
<AssemblyVersion>$(Version)</AssemblyVersion>
99
<FileVersion>$(Version)</FileVersion>
1010
<PackageVersion>$(Version)</PackageVersion>

0 commit comments

Comments
 (0)