Skip to content

Update workflows.yaml #431

Update workflows.yaml

Update workflows.yaml #431

Workflow file for this run

name: "Continuous Integration"
on:
push:
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
pull_request:
paths-ignore:
- '**/*.md'
- '**/*.gitignore'
- '**/*.gitattributes'
workflow_dispatch:
inputs:
version:
description: 'Version (e.g. 1.2.3)'
required: true
release_notes:
description: 'Release Notes'
required: false
deploy_to_nuget:
description: 'Publish to nuget? (yes/no)'
required: true
default: 'no'
jobs:
build:
name: Build Arch
runs-on: ubuntu-latest
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
DOTNET_MULTILEVEL_LOOKUP: 0
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true
TERM: xterm
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
8.0.x
- name: Build
run: ./scripts/Build.sh
- name: Test
run: ./scripts/Test.sh
- name: Upload dotnet test results
uses: actions/upload-artifact@v4
with:
name: dotnet-results
path: TestResults
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
pack:
name: Pack NuGet
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
6.0.x
8.0.x
- name: Pack NuGet package
run: |
dotnet pack --no-build --configuration Release \
--include-symbols --include-source \
-p:PackageVersion=${{ github.event.inputs.version }} \
-p:PackageReleaseNotes="${{ github.event.inputs.release_notes }}" \
-o ./nupkg
- name: Upload all NuGet packages
uses: actions/upload-artifact@v4
with:
name: nuget-artifacts
path: ./nupkg/*
deploy:
name: Deploy NuGet & Release
needs: pack
if: ${{ github.event.inputs.deploy_to_nuget == 'yes' }}
runs-on: ubuntu-latest
steps:
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: nupkg
path: ./nupkg
- name: Push to NuGet
run: |
dotnet nuget push "./nupkg/*.nupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
dotnet nuget push "./nupkg/*.snupkg" \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.version }}
name: v${{ github.event.inputs.version }}
body: ${{ github.event.inputs.release_notes }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload .nupkg to GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ github.event.inputs.version }}
files: |
./nupkg/*.nupkg
./nupkg/*.snupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}