From 4c356d27c217a4ee5b1a80efc672a9e3a0b9e464 Mon Sep 17 00:00:00 2001 From: Adriano Ribeiro Date: Tue, 17 May 2022 00:09:54 -0300 Subject: [PATCH] Create release.yml --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f3659b9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" + + +name: Release + +jobs: + nuget: + name: Publish Nuget + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get the version + id: get_version + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.x + - name: Pack + run: dotnet pack --configuration Release /p:Version=${VERSION} --output . + - name: Push + run: dotnet nuget push *.${VERSION}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_KEY}} + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + needs: nuget + steps: + - name: Create Release Notes + uses: actions/github-script@v4.0.2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + await github.request(`POST /repos/${{ github.repository }}/releases`, { + tag_name: "${{ github.ref }}", + generate_release_notes: true + });