Pool v4.0.2 #14
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: .NET Publish | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
working-directory: src | |
run: dotnet restore | |
- name: Build | |
working-directory: src | |
run: dotnet build -c Debug --no-restore | |
- name: Test | |
working-directory: src | |
run: dotnet test --no-build | |
version: | |
needs: test | |
runs-on: ubuntu-latest | |
outputs: | |
PACKAGE_VERSION: ${{ steps.version-tag.outputs.package_version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Build Version | |
id: version-tag | |
run: | | |
current_tag=$(git tag --sort=committerdate | tail -1) | |
echo current tag: $current_tag | |
major=$(echo $current_tag | cut -d "." -f 1 | cut -d "v" -f 2) | |
minor=$(echo $current_tag | cut -d "." -f 2) | |
patch=$(echo $current_tag | cut -d "." -f 3) | |
package_version="$major.$minor.$patch" | |
echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT | |
publish: | |
needs: | |
- test | |
- version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Echo Package Version | |
run: echo ${{ needs.version.outputs.PACKAGE_VERSION }} | |
- name: Restore | |
working-directory: src/Pool | |
run: dotnet restore | |
- name: Build | |
working-directory: src/Pool | |
run: dotnet build --no-restore -c Release -p:Version=${{ needs.version.outputs.PACKAGE_VERSION }} | |
- name: Pack | |
working-directory: src/Pool | |
run: dotnet pack -c Release -o nuget -p:PackageVersion=${{ needs.version.outputs.PACKAGE_VERSION }} -p:Version=${{ needs.version.outputs.PACKAGE_VERSION }} | |
- name: Publish to nuget.pkg.github.com | |
working-directory: src/Pool | |
run: dotnet nuget push nuget/*.nupkg --skip-duplicate -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/marklauter/index.json | |
- name: Publish to api.nuget.org | |
working-directory: src/Pool | |
run: dotnet nuget push nuget/*.nupkg --skip-duplicate -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json |