avoid specifying an exact version for the action #70
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: | |
- "v*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup dotnet 6.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "6.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: Setup dotnet 7.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "7.0.x" | |
- name: Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: "8.0.x" | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- name: restore | |
run: dotnet restore | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Build | |
run: dotnet build | |
- name: Test | |
run: dotnet test | |
- name: Publish the application binaries (.net6) | |
run: dotnet publish ./src/NuGetUtility/NuGetUtility.csproj -c Release --no-restore -o ./artifacts/net6 -f net6.0 -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Publish the application binaries (.net7) | |
run: dotnet publish ./src/NuGetUtility/NuGetUtility.csproj -c Release --no-restore -o ./artifacts/net7 -f net7.0 -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Publish the application binaries (.net8) | |
run: dotnet publish ./src/NuGetUtility/NuGetUtility.csproj -c Release --no-restore -o ./artifacts/net8 -f net8.0 -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Create nuget package | |
run: dotnet pack ./src/NuGetUtility/NuGetUtility.csproj -c Release --no-build -o ./artifacts -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Zip artifacts | |
uses: tomchavakis/[email protected] | |
with: | |
args: zip -qq -r ./release.zip ./artifacts | |
- name: Create release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release.zip | |
asset_name: release.zip | |
asset_content_type: application/zip | |
- name: publish nuget package to nuget.org | |
id: publish_nuget | |
run: dotnet nuget push ./artifacts/*.nupkg -s 'https://api.nuget.org/v3/index.json' -k ${{secrets.NUGET_KEY}} --skip-duplicate |