From f04ee3273439adff95ce1896cb2352d16a0047a5 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 10:32:11 +0200 Subject: [PATCH 01/11] Add changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1c3e710 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and adheres to a project-specific [Versioning](/README.md). + +## [Unreleased] + +### Added + +- Changelog From 40b1f746f04ff674fa5893677480ae7edb15ae29 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 10:40:29 +0200 Subject: [PATCH 02/11] Avoid nuget push while experimenting --- .github/workflows/create-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4fdc3c0..a1cb451 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -14,7 +14,7 @@ on: pre_release: type: choice - description: Pre Release? + description: Stage options: - stable - alpha @@ -85,7 +85,7 @@ jobs: - name: Create TestsRuleset package run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec - - name: Push all packages to Nuget.org - run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg - env: - NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} + #- name: Push all packages to Nuget.org + # run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg + # env: + # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} From 2e233e601c88d3a33ead4edc59420d908caca5d7 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 10:44:47 +0200 Subject: [PATCH 03/11] Use npx --- .github/workflows/create-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index a1cb451..24488f8 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -68,7 +68,7 @@ jobs: - name: Get next release number run: | - echo "RELEASE_VERSION=$(release-it --release-version --dry-run)" >> $GITHUB_ENV + echo "RELEASE_VERSION=$(npx release-it --release-version --dry-run)" >> $GITHUB_ENV - name: Print release version run: echo "The next release number is ${{ env.RELEASE_VERSION }}" From f4360517932273f1f46c90f3a00b93e76d4fc530 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 10:51:27 +0200 Subject: [PATCH 04/11] Try different way to get the version number --- .github/workflows/create-release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 24488f8..4af17c8 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -17,9 +17,9 @@ on: description: Stage options: - stable - - alpha - - beta - rc + - beta + - alpha jobs: release-it: @@ -67,11 +67,11 @@ jobs: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Get next release number - run: | - echo "RELEASE_VERSION=$(npx release-it --release-version --dry-run)" >> $GITHUB_ENV - + id: release + run: echo "::set-output name=version::$(npx release-it --release-version --dry-run)" + - name: Print release version - run: echo "The next release number is ${{ env.RELEASE_VERSION }}" + run: echo "The next release number is ${{ steps.release.outputs.version }}" - name: Replace version number in nuspec files run: 'sed -i -e "s/{{NuGetVersion}}/$GITVERSION_NUGETVERSION/g" *.nuspec' From c06df3c384af4a2b50eda8be83934b0b4ec4e9ab Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 10:59:53 +0200 Subject: [PATCH 05/11] Change trigger for publishing nuget package --- .github/workflows/create-release.yml | 30 +++------------------------- .github/workflows/dotnet-publish.yml | 28 ++++++++------------------ 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4af17c8..f9001fe 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -7,10 +7,10 @@ on: type: choice description: Semantic Version Type options: - - major - - minor - - patch - no-version-update + - patch + - minor + - major pre_release: type: choice @@ -65,27 +65,3 @@ jobs: release-it -y "${params[@]}" env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - - - name: Get next release number - id: release - run: echo "::set-output name=version::$(npx release-it --release-version --dry-run)" - - - name: Print release version - run: echo "The next release number is ${{ steps.release.outputs.version }}" - - - name: Replace version number in nuspec files - run: 'sed -i -e "s/{{NuGetVersion}}/$GITVERSION_NUGETVERSION/g" *.nuspec' - - - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1.0.5 - - - name: Create main package - run: nuget pack Neolution.CodeAnalysis.nuspec - - - name: Create TestsRuleset package - run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec - - #- name: Push all packages to Nuget.org - # run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg - # env: - # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index fab21d2..6bfb93f 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -2,10 +2,8 @@ name: Publish NuGet package on: - push: - tags: - - 'v*.*.*' - workflow_dispatch: + release: + types: [published] env: ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json @@ -16,20 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Needed for GitVersion to function correctly - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 - with: - versionSpec: '5.x' - - - name: Determine version number with GitVersion - uses: gittools/actions/gitversion/execute@v0.9.7 + uses: actions/checkout@v3 - name: Replace version number in nuspec files - run: 'sed -i -e "s/{{NuGetVersion}}/$GITVERSION_NUGETVERSION/g" *.nuspec **/*.targets' + run: 'sed -i -e "s/{{NuGetVersion}}/${{ github.ref }}/g" *.nuspec **/*.targets' - name: Setup NuGet.exe for use with actions uses: NuGet/setup-nuget@v1.0.5 @@ -40,7 +28,7 @@ jobs: - name: Create TestsRuleset package run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec - - name: Push all packages to Nuget.org - run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg - env: - NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} + #- name: Push all packages to Nuget.org + # run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg + # env: + # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} From 9d4619bfa4fa0a668099d744e3b795075902ebac Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 11:18:36 +0200 Subject: [PATCH 06/11] Cut the first part of the Github Ref to get the version number --- .github/workflows/dotnet-publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index 6bfb93f..e5ff063 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -15,9 +15,13 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - + + - name: Get the NuGet version number + id: get_version + run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV + - name: Replace version number in nuspec files - run: 'sed -i -e "s/{{NuGetVersion}}/${{ github.ref }}/g" *.nuspec **/*.targets' + run: 'sed -i -e "s/{{NuGetVersion}}/$NUGET_VERSION/g" *.nuspec **/*.targets' - name: Setup NuGet.exe for use with actions uses: NuGet/setup-nuget@v1.0.5 From 06572eb967c2e1402064b2839ef0005f53dc25fd Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 11:25:02 +0200 Subject: [PATCH 07/11] Let's try publish Nugets again --- .github/workflows/dotnet-publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index e5ff063..badb89c 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -32,7 +32,7 @@ jobs: - name: Create TestsRuleset package run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec - #- name: Push all packages to Nuget.org - # run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg - # env: - # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} + - name: Push all packages to Nuget.org + run: dotnet nuget push --skip-duplicate -s $ARTIFACTS_FEED_URL -k $NUGET_AUTH_TOKEN **/*.nupkg + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }} From 3b02fd60044326253d73cc2ec8ac00d5ffeabe56 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 11:37:10 +0200 Subject: [PATCH 08/11] Cleanup --- .github/workflows/dotnet-publish.yml | 3 +-- .github/workflows/dotnet.yml | 20 ++++++-------------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/dotnet-publish.yml index badb89c..e8aced2 100644 --- a/.github/workflows/dotnet-publish.yml +++ b/.github/workflows/dotnet-publish.yml @@ -16,8 +16,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Get the NuGet version number - id: get_version + - name: Determine version for NuGet package run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV - name: Replace version number in nuspec files diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 89df5ae..80ddff4 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -13,20 +13,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Needed for GitVersion to function correctly - - - name: Install GitVersion - uses: gittools/actions/gitversion/setup@v0.9.7 - with: - versionSpec: '5.x' - - - name: Determine version number with GitVersion - uses: gittools/actions/gitversion/execute@v0.9.7 - + uses: actions/checkout@v3 + + - name: Determine version for NuGet package + run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV + - name: Replace version number in nuspec files - run: 'sed -i -e "s/{{NuGetVersion}}/$GITVERSION_NUGETVERSION/g" *.nuspec **/*.targets' + run: 'sed -i -e "s/{{NuGetVersion}}/$NUGET_VERSION/g" *.nuspec **/*.targets' - name: Setup NuGet.exe for use with actions uses: NuGet/setup-nuget@v1.0.5 @@ -36,4 +29,3 @@ jobs: - name: Create TestsRuleset package run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec - From 5ba85916f44bd240851951cb5ff9c3fe7bf7430f Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 11:39:21 +0200 Subject: [PATCH 09/11] Rename Github Action Workflow files --- .github/workflows/{dotnet-publish.yml => cd-production.yml} | 0 .github/workflows/{dotnet.yml => ci.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{dotnet-publish.yml => cd-production.yml} (100%) rename .github/workflows/{dotnet.yml => ci.yml} (100%) diff --git a/.github/workflows/dotnet-publish.yml b/.github/workflows/cd-production.yml similarity index 100% rename from .github/workflows/dotnet-publish.yml rename to .github/workflows/cd-production.yml diff --git a/.github/workflows/dotnet.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/dotnet.yml rename to .github/workflows/ci.yml From ee1ee088cf04f613048b69d3f1168c555499f7e7 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 12:45:07 +0200 Subject: [PATCH 10/11] Fix CI workflow --- .github/workflows/cd-production.yml | 2 +- .github/workflows/ci.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-production.yml b/.github/workflows/cd-production.yml index e8aced2..5e414e3 100644 --- a/.github/workflows/cd-production.yml +++ b/.github/workflows/cd-production.yml @@ -23,7 +23,7 @@ jobs: run: 'sed -i -e "s/{{NuGetVersion}}/$NUGET_VERSION/g" *.nuspec **/*.targets' - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1.0.5 + uses: NuGet/setup-nuget@v1.2.0 - name: Create main package run: nuget pack Neolution.CodeAnalysis.nuspec diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80ddff4..6395473 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,13 @@ jobs: uses: actions/checkout@v3 - name: Determine version for NuGet package - run: echo NUGET_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV + run: echo NUGET_VERSION=$(date '+%Y.%m.%d-ci%H%M%S') >> $GITHUB_ENV - name: Replace version number in nuspec files run: 'sed -i -e "s/{{NuGetVersion}}/$NUGET_VERSION/g" *.nuspec **/*.targets' - name: Setup NuGet.exe for use with actions - uses: NuGet/setup-nuget@v1.0.5 + uses: NuGet/setup-nuget@v1.2.0 - name: Create main package run: nuget pack Neolution.CodeAnalysis.nuspec From 272be76fd48a5d9d9c84ed2508d90274469dec51 Mon Sep 17 00:00:00 2001 From: Sandro Ciervo Date: Wed, 14 Jun 2023 12:49:59 +0200 Subject: [PATCH 11/11] Prepend CI versioning with 0. to avoid problems when accidentally pushing to Nuget.org --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6395473..0df731e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: uses: actions/checkout@v3 - name: Determine version for NuGet package - run: echo NUGET_VERSION=$(date '+%Y.%m.%d-ci%H%M%S') >> $GITHUB_ENV + run: echo NUGET_VERSION=0.$(date '+%Y.%m')-ci.$(date '+%d%H%M%S') >> $GITHUB_ENV - name: Replace version number in nuspec files run: 'sed -i -e "s/{{NuGetVersion}}/$NUGET_VERSION/g" *.nuspec **/*.targets'