From bf3d8645f26066b99f59224c14fe1c3f20ab655f Mon Sep 17 00:00:00 2001 From: Yauheni Pakala Date: Tue, 3 May 2022 02:06:30 +0300 Subject: [PATCH] Add release build workflow --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 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..808a0f6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +on: + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" +env: + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_CLI_TELEMETRY_OPTOUT: true +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Verify commit exists in origin/master + run: | + git fetch --no-tags --prune --depth=1 origin '+refs/heads/*:refs/remotes/origin/*' + git branch --remote --contains | grep origin/master + - name: Set VERSION variable from tag + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - name: Pack + run: | + dotnet pack FB2Library/FB2Library.csproj \ + -p:NuspecFile=../nuget/FB2Library.nuspec \ + -p:NuspecProperties="version=${VERSION}" \ + --configuration Release \ + --verbosity normal \ + --include-symbols \ + --include-source \ + --output . + - name: Upload Artifact + uses: actions/upload-artifact@v2 + with: + name: nupkg + path: '*.nupkg' + + deploy-nuget: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download Artifact + uses: actions/download-artifact@v1 + with: + name: nupkg + - name: Push to NuGet + run: | + dotnet nuget push ./nupkg/FB2Library.*.nupkg \ + --source ${FEED_URL} \ + --api-key ${FEED_KEY} + env: + FEED_URL: https://api.nuget.org/v3/index.json + FEED_KEY: ${{ secrets.NUGET_KEY }} \ No newline at end of file