update secret #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: ['[0-9]+.[0-9]+.[0-9]+'] | |
paths-ignore: [ 'docs/**' ] | |
permissions: write-all | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: nuget | |
env: | |
SLN_FILE: GeoblockingMiddleware.sln | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract version from tag | |
uses: damienaicheh/extract-version-from-tag-action@v1.0.0 | |
- name: Set release version | |
run: | | |
if [ "${PRE_RELEASE}" == "" ]; then | |
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH} | |
else | |
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH}-${PRE_RELEASE} | |
fi | |
echo "Release version is $RELEASE_VERSION" | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_ENV" | |
- name: Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
validation_level: warn | |
version: '${{ env.RELEASE_VERSION }}' | |
path: ./CHANGELOG.md | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
- name: Restore | |
run: dotnet restore ${SLN_FILE} | |
- name: Build | |
run: dotnet build -p:Version="${MAJOR}.${MINOR}.${PATCH}" --no-restore --configuration Release ${SLN_FILE} | |
- name: Test | |
run: dotnet test -p:Version="${MAJOR}.${MINOR}.${PATCH}" --no-build --configuration Release ${SLN_FILE} | |
- name: Pack | |
run: | | |
dotnet pack ${SLN_FILE} -p:Version=${RELEASE_VERSION} -p:PackageReleaseNotes="${{ steps.changelog_reader.outputs.changes }}" -c Release --property PackageOutputPath=${PWD}/nupkgs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: nupkgs/ | |
- name: Push | |
run: | | |
dotnet nuget push "nupkgs/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.GEOBLOCKINGMIDDLEWARE_NUGET_TOKEN }} --skip-duplicate |