From a1942c204f1bd59b984680ac66cb57bf1fd07470 Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 11:18:17 -0800 Subject: [PATCH 1/8] adding first step of nuget auto publish --- .github/workflows/publish.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2a5a705..97ffc3f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,7 @@ name: Publish to GitHub Packages # events but only for the master branch on: push: - branches: [ master ] + branches: [ semver-release ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -37,3 +37,10 @@ jobs: - name: Push to GitHub Packages run: dotnet nuget push (Join-Path "drop" "*.nupkg") shell: pwsh + + - name: Publish NuGet.org + uses: brandedoutcast/publish-nuget@v2.5.5 + with: + PROJECT_FILE_PATH: src/qram.csproj + #NUGET_KEY: ${{secrets.NUGET_API_KEY}} + VERSION_STATIC: 0.1.$Env:GITHUB_RUN_NUMBER \ No newline at end of file From f1ae41feb5dd1a9ed8616b1a9586c87ee9426ab7 Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 11:22:46 -0800 Subject: [PATCH 2/8] adding secret --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 97ffc3f..1f3ab12 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -42,5 +42,5 @@ jobs: uses: brandedoutcast/publish-nuget@v2.5.5 with: PROJECT_FILE_PATH: src/qram.csproj - #NUGET_KEY: ${{secrets.NUGET_API_KEY}} + NUGET_KEY: ${{secrets.NUGET_API_KEY}} VERSION_STATIC: 0.1.$Env:GITHUB_RUN_NUMBER \ No newline at end of file From 1136ba5055ddb99d030e001f8065699cc7205b1e Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 13:31:41 -0800 Subject: [PATCH 3/8] adding new nuget publish --- .github/workflows/publish-nuget.yml | 39 +++++++++++++++++++++++++++++ .github/workflows/publish.yml | 10 ++------ 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/publish-nuget.yml diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..0b6ae0b --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -0,0 +1,39 @@ +# This is a basic workflow to help you get started with Actions + +name: Publish to GitHub Packages + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ semver-release ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: windows-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + # https://stackoverflow.com/questions/57889719/how-to-push-nuget-package-in-github-actions + - name: "Setup .NET Core @ Latest" + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' + source-url: https://api.nuget.org + env: + NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}} + + # Runs a set of commands using the runners shell + - name: .NET pack + run: dotnet pack -c Release -o ../drop /p:Version="0.1.$Env:GITHUB_RUN_NUMBER" + shell: pwsh + working-directory: src + + - name: Push to GitHub Packages + run: dotnet nuget push (Join-Path "drop" "*.nupkg") + shell: pwsh diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1f3ab12..765ae2d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,7 @@ name: Publish to GitHub Packages # events but only for the master branch on: push: - branches: [ semver-release ] + branches: [ master ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -37,10 +37,4 @@ jobs: - name: Push to GitHub Packages run: dotnet nuget push (Join-Path "drop" "*.nupkg") shell: pwsh - - - name: Publish NuGet.org - uses: brandedoutcast/publish-nuget@v2.5.5 - with: - PROJECT_FILE_PATH: src/qram.csproj - NUGET_KEY: ${{secrets.NUGET_API_KEY}} - VERSION_STATIC: 0.1.$Env:GITHUB_RUN_NUMBER \ No newline at end of file + \ No newline at end of file From 347f872ff2ae16660ee9aee08a48d21c7653a801 Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 13:35:06 -0800 Subject: [PATCH 4/8] fix name --- .github/workflows/publish-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 0b6ae0b..ae987d3 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -1,6 +1,6 @@ # This is a basic workflow to help you get started with Actions -name: Publish to GitHub Packages +name: Publish to Nuget.org # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch From c0983125c2b5e0eafe4cece68e127e65c9e8f68d Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 13:38:09 -0800 Subject: [PATCH 5/8] fixed source url for nuget.org --- .github/workflows/publish-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index ae987d3..93a55b1 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -24,7 +24,7 @@ jobs: uses: actions/setup-dotnet@v1 with: dotnet-version: '3.1.x' - source-url: https://api.nuget.org + source-url: https://api.nuget.org/v3/index.json env: NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}} From 34f7c80f0301d80cb375ec0f20f913c905ac4c88 Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Fri, 6 Nov 2020 13:52:08 -0800 Subject: [PATCH 6/8] directly adding API key --- .github/workflows/publish-nuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 93a55b1..40aaa8f 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -35,5 +35,5 @@ jobs: working-directory: src - name: Push to GitHub Packages - run: dotnet nuget push (Join-Path "drop" "*.nupkg") + run: dotnet nuget push (Join-Path "drop" "*.nupkg") --api-key ${{secrets.NUGET_API_KEY}} shell: pwsh From bf88e7cbfce097afadadf4e206f693d4577839f2 Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Tue, 10 Nov 2020 10:40:23 -0800 Subject: [PATCH 7/8] checking symver tagging --- .github/workflows/publish-nuget.yml | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 40aaa8f..6b18dcb 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -1,15 +1,18 @@ # This is a basic workflow to help you get started with Actions -name: Publish to Nuget.org +name: Publish to nuget.org # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: - push: - branches: [ semver-release ] + pull_request: + branches: + - master + #types: [closed] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: + #if: github.event.pull_request.merged == true # This workflow contains a single job called "build" build: # The type of runner that the job will run on @@ -19,6 +22,19 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 + + - id: bump + name: Determine version change + uses: zwaldowski/match-label-action@v1 + with: + allowed: major,minor,patch + - id: version + uses: zwaldowski/semver-release-action@v1 + name: Create new version number for this release + with: + bump: ${{ steps.bump.outputs.match }} + github_token: ${{ secrets.GITHUB_TOKEN }} + # https://stackoverflow.com/questions/57889719/how-to-push-nuget-package-in-github-actions - name: "Setup .NET Core @ Latest" uses: actions/setup-dotnet@v1 @@ -28,12 +44,13 @@ jobs: env: NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}} + # Runs a set of commands using the runners shell - name: .NET pack - run: dotnet pack -c Release -o ../drop /p:Version="0.1.$Env:GITHUB_RUN_NUMBER" + run: dotnet pack -c Release -o ../drop /p:Version=${{ steps.version.outputs.version }} shell: pwsh working-directory: src - - name: Push to GitHub Packages - run: dotnet nuget push (Join-Path "drop" "*.nupkg") --api-key ${{secrets.NUGET_API_KEY}} - shell: pwsh + # - name: Push to nuget.org + # run: dotnet nuget push (Join-Path "drop" "*.nupkg") --api-key ${{secrets.NUGET_API_KEY}} + # shell: pwsh From a516f2b6b163e6fb06f4cfd376b4bb8363973bac Mon Sep 17 00:00:00 2001 From: Sarah Kaiser Date: Tue, 10 Nov 2020 10:58:13 -0800 Subject: [PATCH 8/8] change accepted label spec --- .github/workflows/publish-nuget.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 6b18dcb..51d24a9 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -27,8 +27,11 @@ jobs: name: Determine version change uses: zwaldowski/match-label-action@v1 with: - allowed: major,minor,patch - - id: version + allowed: > + major + minor + patch + - id: semver uses: zwaldowski/semver-release-action@v1 name: Create new version number for this release with: @@ -47,7 +50,7 @@ jobs: # Runs a set of commands using the runners shell - name: .NET pack - run: dotnet pack -c Release -o ../drop /p:Version=${{ steps.version.outputs.version }} + run: dotnet pack -c Release -o ../drop /p:Version=${{ steps.semver.outputs.version }} shell: pwsh working-directory: src