Merge pull request #189 from mivano/fix/issue-178 #44
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Build, Pack and Release on Tag | |
on: | |
push: | |
tags: | |
- '*' | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
permissions: | |
contents: write | |
discussions: write | |
jobs: | |
build-pack-release: | |
runs-on: ubuntu-latest | |
if: | | |
(!startsWith(github.event.head_commit.message, 'skip-ci') | |
&& !startsWith(github.event.head_commit.message, 'chore:')) | |
|| startsWith(github.ref, 'refs/tags/') | |
defaults: | |
run: | |
working-directory: ./src | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.0.x | |
9.0.x | |
- name: Get the tag version | |
id: get_version | |
run: | | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
- name: Build and Pack | |
run: | | |
dotnet build --configuration Release /p:Version=$TAG_NAME /p:AssemblyVersion=$TAG_NAME /p:FileVersion=$TAG_NAME | |
dotnet pack --configuration Release /p:PackageVersion=$TAG_NAME /p:Version=$TAG_NAME /p:AssemblyVersion=$TAG_NAME /p:FileVersion=$TAG_NAME --output nupkgs | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: src/nupkgs/*.nupkg | |
- name: Push NuGet Package | |
run: | | |
dotnet nuget push nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Create GitHub Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: src/nupkgs/*.nupkg | |
generate_release_notes: true | |