Skip to content

Update deploy.yml

Update deploy.yml #4

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Deploy
on:
push:
tags:
- "v*" # Only run if a tag is pressent
workflow_dispatch:
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7.0.x
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore -warnaserror
- name: Test
run: dotnet test --verbosity normal
Deploy:
runs-on: ubuntu-latest
needs: Build
steps:
- uses: actions/checkout@v3
- name: Get Tag
id: tag
run: echo "::set-output name=tag::${{ github.ref }}"
- name: Extract Version
id: version
run: |
tag_ref="${{ steps.tag.outputs.tag }}"
version=$(echo "$tag_ref" | sed -n 's|^refs/tags/v\(.*\)$|\1|p')
echo "::set-output name=version::$version"
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
7.0.x
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Pack
run: dotnet pack --include-symbols --output nupkgs -p:PackageVersion=${{ steps.version.outputs.version }} -p Configuration="Release"
- name: Publish Artifact
uses: actions/upload-artifact@v2
with:
name: Package
path: nupkgs/**/*.nupkg
- uses: ncipollo/release-action@v1
with:
name: "Release ${{ steps.version.outputs.version }}"
artifacts: "*"
generateReleaseNotes: true