Skip to content

Commit f1dcd79

Browse files
RigesCopilot
andauthored
chore: Extract release workflow for automated NuGet package publishing with release-drafter action (#179)
This pull request includes significant changes to the GitHub Actions workflows, specifically around the CI and release processes. The most important changes involve the removal of the old CI workflow and the addition of a new release workflow. Changes to GitHub Actions workflows: * [`.github/workflows/ci.yml`](diffhunk://#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fL1-L70): Removed the entire CI workflow configuration, which included testing on multiple operating systems, building packages, and publishing artifacts. * [`.github/workflows/release.yml`](diffhunk://#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R1-R50): Added a new release workflow configuration that triggers on tag pushes, builds and tests the package, and publishes the NuGet package and release artifacts. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 25be586 commit f1dcd79

3 files changed

Lines changed: 51 additions & 70 deletions

File tree

.github/release-drafter.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
commitish: master
12
name-template: "Release $RESOLVED_VERSION"
23
tag-template: "v$RESOLVED_VERSION"
34
template: |

.github/workflows/ci.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*.*
7+
8+
jobs:
9+
Publish:
10+
name: Create NuGet Package
11+
runs-on: ubuntu-latest
12+
env:
13+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
14+
steps:
15+
- name: Get the version
16+
id: version
17+
run: |
18+
tag=${GITHUB_REF/refs\/tags\//}
19+
version=${tag#v}
20+
echo "VERSION=${version}" >> $GITHUB_ENV
21+
echo "version=${version}" >> $GITHUB_OUTPUT
22+
echo "TAG=${tag}" >> $GITHUB_ENV
23+
echo "tag=${tag}" >> $GITHUB_OUTPUT
24+
- uses: actions/checkout@v4
25+
- name: Setup dotnet
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
global-json-file: global.json
29+
cache: true
30+
cache-dependency-path: '**/packages.lock.json'
31+
- name: Restore packages
32+
run: dotnet restore --locked-mode
33+
- name: Test
34+
run: dotnet test --configuration Release
35+
- name: Build NuGet Package
36+
run: dotnet pack -c Release -p:PackageVersion="${{ env.VERSION }}" --output ./output
37+
- name: Publish Artifacts
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: Netatmo.${{ env.VERSION }}.nupkg
41+
path: './output/Netatmo.${{ env.VERSION }}.nupkg'
42+
- name: Push package
43+
run: dotnet nuget push ./output/Netatmo.${{ env.VERSION }}.nupkg -k ${{ secrets.NUGET_ORG_KEY }} -s https://api.nuget.org/v3/index.json
44+
45+
- uses: release-drafter/release-drafter@v6
46+
with:
47+
version: ${{ steps.version.outputs.version }}
48+
publish: true
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)