CHANGELOG: v2.0.3 #130
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: cd | |
on: | |
workflow_dispatch: | |
inputs: | |
Publish: | |
description: 'Publish option' | |
required: true | |
default: 'NuGetTest' | |
type: choice | |
options: | |
- NuGet | |
- NuGetTest | |
push: | |
branches: | |
- "**" | |
paths: | |
- ".github/workflows/cd.yml" | |
- "docs/build.ps1" | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages # NuGet CLI environment variables | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
7.0.x | |
8.0.x | |
cache: true | |
cache-dependency-path: '**/packages.lock.json' | |
- run: | | |
dotnet restore --locked-mode | |
dotnet tool update -g dotnet-script | |
dotnet tool update -g docfx | |
- id: build | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
dotnet script ./tools/Builder/Build.csx | |
./docs/build.ps1 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: nupkgs | |
path: nupkgs | |
retention-days: 7 | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/_site | |
outputs: | |
tag: ${{ steps.build.outputs.tag }} | |
version: ${{ steps.build.outputs.version }} | |
is_release: ${{ steps.build.outputs.is_release }} | |
test: | |
needs: [ build ] | |
runs-on: windows-latest | |
if: needs.build.outputs.is_release != 'True' && github.event.inputs.Publish != 'NuGet' | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: nupkgs | |
- name: Publish the package to nugettest.org # need secrets.NUGETTEST_TOKEN | |
run: dotnet nuget push *.nupkg --api-key ${{ secrets.NUGETTEST_TOKEN }} --source https://apiint.nugettest.org/v3/index.json | |
release: | |
needs: [ build ] | |
runs-on: windows-latest | |
if: needs.build.outputs.is_release == 'True' || github.event.inputs.Publish == 'NuGet' | |
permissions: | |
contents: write | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Publish the package to nuget.org # need secrets.NUGET_TOKEN | |
run: | | |
cd nupkgs | |
dotnet nuget push *.nupkg --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
- name: Re-zip docs | |
run: | | |
cd github-pages | |
7z x artifact.tar -o'${{ needs.build.outputs.version }}' | |
7z a docs.zip '${{ needs.build.outputs.version }}' | |
- if: needs.build.outputs.is_release == 'True' | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: CHANGELOG.md | |
tag_name: ${{ needs.build.outputs.tag }} | |
files: github-pages/docs.zip |