v0.0.6 #20
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
# Ref: https://github.com/giraffe-fsharp/Giraffe/blob/master/.github/workflows/build.yml | |
name: SectionMattr Deploy | |
on: | |
push: | |
pull_request: | |
release: | |
types: | |
- published | |
env: | |
# Project name to pack and publish | |
PROJECT_NAME: SectionMattr | |
# Official NuGet Feed settings | |
NUGET_FEED: https://api.nuget.org/v3/index.json | |
NUGET_KEY: ${{ secrets.NUGET_KEY }} | |
# Kill other jobs when we trigger this workflow by sending new commits to the PR. | |
# https://stackoverflow.com/a/72408109 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
timeout-minutes: 60 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-22.04, windows-2022, macos-14 ] | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- | |
name: Restore dotnet tool & dependency | |
run: | | |
dotnet tool restore | |
dotnet restore | |
- | |
name: Build | |
run: dotnet build -c Release --no-restore | |
- | |
name: Run unit test | |
run: dotnet test -c Release | |
- | |
name: Pack | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
latestTag=$(git describe --tags --abbrev=0 2>/dev/null || echo 0.0.1) | |
runId=$GITHUB_RUN_ID | |
packageVersion="${latestTag//v}-build.${runId}" | |
dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$packageVersion $PROJECT_NAME/$PROJECT_NAME.*proj | |
- | |
name: Upload Artifact | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg | |
path: ./$PROJECT_NAME/bin/Release/*.nupkg | |
deploy: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Setup dotnet | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- | |
name: Create Release NuGet package | |
run: | | |
arrTag=(${GITHUB_REF//\// }) | |
VERSION="${arrTag[2]}" | |
echo Version: $VERSION | |
VERSION="${VERSION//v}" | |
echo Clean Version: $VERSION | |
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg $PROJECT_NAME/$PROJECT_NAME.*proj | |
- | |
name: Push to NuGet Feed | |
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY |