Build #14
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{github.run_number}} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout" | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: "Install .NET Core SDK" | |
uses: actions/[email protected] | |
- name: "Dotnet Tool Restore" | |
run: dotnet tool restore | |
shell: bash | |
- name: "Dotnet Cake Build" | |
run: dotnet cake --target=Build | |
shell: bash | |
- name: "Dotnet Cake Test" | |
run: dotnet cake --target=Test | |
shell: bash | |
- name: "Dotnet Cake Pack" | |
run: dotnet cake --target=Pack | |
shell: bash | |
- name: "Publish Artifacts" | |
uses: actions/[email protected] | |
with: | |
name: "BuildArtifacts" | |
path: "./Artifacts" | |
push-nuget: | |
name: "Push NuGet Packages" | |
needs: build | |
if: github.event_name == 'release' | |
environment: | |
name: "NuGet" | |
url: https://www.nuget.org/packages/sable | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Download Artifact" | |
uses: actions/[email protected] | |
with: | |
name: "BuildArtifacts" | |
- name: "Dotnet NuGet Push" | |
run: | | |
for package in *.nupkg; do | |
if [[ "$package" != *preview* ]]; then | |
dotnet nuget push "$package" \ | |
--source https://api.nuget.org/v3/index.json \ | |
--skip-duplicate \ | |
--api-key ${{ secrets.NUGET_API_KEY }}; | |
fi; | |
done | |
shell: bash |