From 2d34084472d8dc93fdf947f48e65cc0884bca38a Mon Sep 17 00:00:00 2001 From: Riges Date: Fri, 11 Apr 2025 14:35:39 +0200 Subject: [PATCH 1/7] chore: Extract release workflow for automated NuGet package publishing with release-drafter action --- .github/workflows/ci.yml | 70 ----------------------------------- .github/workflows/release.yml | 50 +++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 2b54974..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: CI - -on: - push: - tags: - - '*' - -jobs: - test: - name: Test on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - env: - NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages - - steps: - - uses: actions/checkout@v4 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - global-json-file: global.json - cache: true - cache-dependency-path: '**/packages.lock.json' - - name: Restore packages - run: dotnet restore --locked-mode - - name: Test - run: dotnet test --configuration Release - - build: - name: Create Package nuget - needs: test - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - env: - NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages - steps: - - name: Dump GitHub context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - name: Get the version - run: | - echo "TAG=${GITHUB_REF:10}" >> $GITHUB_ENV - - uses: actions/checkout@v4 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 - with: - global-json-file: global.json - cache: true - cache-dependency-path: '**/packages.lock.json' - - name: Restore packages - run: dotnet restore --locked-mode - - name: Build and create package nuget - run: dotnet pack -c Release -p:PackageVersion=$TAG - - name: Publish artifact - uses: actions/upload-artifact@master - with: - name: Netatmo.${{ env.TAG }}.nupkg - path: src/Netatmo/bin/Release/Netatmo.${{ env.TAG }}.nupkg - - name: Create Release - uses: softprops/action-gh-release@v2 - with: - files: | - src/Netatmo/bin/Release/Netatmo.${{ env.TAG }}.nupkg - name: Release ${{ env.TAG }} - generate_release_notes: true - - name: Push package - run: dotnet nuget push src/Netatmo/bin/Release/Netatmo.$TAG.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..08a15fb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release + +on: + push: + tags: + - v*.*.* + +jobs: + Publish: + name: Create Package nuget + runs-on: ubuntu-latest + env: + NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages + steps: + - name: Get the version + id: version + run: | + tag=${GITHUB_REF/refs\/tags\//} + version=${tag#v} + echo "VERSION=${version}" >> $GITHUB_ENV + echo "version=${version}" >> $GITHUB_OUTPUT + echo "TAG=${tag}" >> $GITHUB_ENV + echo "tag=${tag}" >> $GITHUB_OUTPUT + - uses: actions/checkout@v4 + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + cache: true + cache-dependency-path: '**/packages.lock.json' + - name: Restore packages + run: dotnet restore --locked-mode + - name: Test + run: dotnet test --configuration Release + - name: Build package nuget + run: dotnet pack -c Release -p:PackageVersion=$VERSION --output ./output + - name: Publish Artefacts + uses: actions/upload-artifact@v4 + with: + name: Netatmo.${{ env.VERSION }}.nupkg + path: './output/Netatmo.${{ env.VERSION }}.nupkg' + - name: Push package + run: dotnet nuget push ./output/Netatmo.$VERSION.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json + + - uses: release-drafter/release-drafter@master + with: + version: ${{ steps.version.outputs.version }} + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From bb4e05af3790dcde595a16648cb47ea8f8e9bfdc Mon Sep 17 00:00:00 2001 From: Riges Date: Fri, 11 Apr 2025 14:40:04 +0200 Subject: [PATCH 2/7] apply copilot proposal --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08a15fb..97e9448 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: jobs: Publish: - name: Create Package nuget + name: Create NuGet Package runs-on: ubuntu-latest env: NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages From 5aaa27da2faee7d57ec1cb28aef3a32310f155a7 Mon Sep 17 00:00:00 2001 From: Luc FASQUELLE Date: Fri, 11 Apr 2025 14:47:04 +0200 Subject: [PATCH 3/7] Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97e9448..3d3ccd7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,7 +34,7 @@ jobs: run: dotnet test --configuration Release - name: Build package nuget run: dotnet pack -c Release -p:PackageVersion=$VERSION --output ./output - - name: Publish Artefacts + - name: Publish Artifacts uses: actions/upload-artifact@v4 with: name: Netatmo.${{ env.VERSION }}.nupkg From 572220ba1bcac9ea3bdfd0599d778e66e3be0f04 Mon Sep 17 00:00:00 2001 From: Riges Date: Fri, 11 Apr 2025 14:49:12 +0200 Subject: [PATCH 4/7] apply copilot comments --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d3ccd7..6ce219d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,7 +32,7 @@ jobs: run: dotnet restore --locked-mode - name: Test run: dotnet test --configuration Release - - name: Build package nuget + - name: Build NuGet Package run: dotnet pack -c Release -p:PackageVersion=$VERSION --output ./output - name: Publish Artifacts uses: actions/upload-artifact@v4 @@ -40,7 +40,7 @@ jobs: name: Netatmo.${{ env.VERSION }}.nupkg path: './output/Netatmo.${{ env.VERSION }}.nupkg' - name: Push package - run: dotnet nuget push ./output/Netatmo.$VERSION.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json + run: dotnet nuget push ./output/Netatmo.${{ env.VERSION }}.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json - uses: release-drafter/release-drafter@master with: From d00a5a4e9f1ab5b6180db73856abea029d30db94 Mon Sep 17 00:00:00 2001 From: Riges Date: Fri, 11 Apr 2025 14:51:01 +0200 Subject: [PATCH 5/7] use same version of release-drafter action --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6ce219d..75d423b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,7 +42,7 @@ jobs: - name: Push package run: dotnet nuget push ./output/Netatmo.${{ env.VERSION }}.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json - - uses: release-drafter/release-drafter@master + - uses: release-drafter/release-drafter@v6 with: version: ${{ steps.version.outputs.version }} publish: true From fd6eb5278a22424fae31f4a384fc0fd8fe458f95 Mon Sep 17 00:00:00 2001 From: Riges Date: Fri, 11 Apr 2025 14:53:36 +0200 Subject: [PATCH 6/7] be consistent --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75d423b..6d7d931 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Test run: dotnet test --configuration Release - name: Build NuGet Package - run: dotnet pack -c Release -p:PackageVersion=$VERSION --output ./output + run: dotnet pack -c Release -p:PackageVersion="${{ env.VERSION }}" --output ./output - name: Publish Artifacts uses: actions/upload-artifact@v4 with: From 420d1dcbbce6fac44d22854aa213e4100cea29d1 Mon Sep 17 00:00:00 2001 From: Riges Date: Mon, 14 Apr 2025 10:45:35 +0200 Subject: [PATCH 7/7] try something --- .github/release-drafter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 65460f5..7907591 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,3 +1,4 @@ +commitish: master name-template: "Release $RESOLVED_VERSION" tag-template: "v$RESOLVED_VERSION" template: |