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 + });