doc: add docs section #195
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: CD - Build and Publish NuGet Package | |
on: | |
push: | |
branches: | |
- master | |
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 on Windows | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Install .NET Core SDK | |
uses: actions/[email protected] | |
with: | |
dotnet-version: '8.0.x' | |
- name: List SDKs | |
shell: pwsh | |
run: dotnet --list-sdks | |
- name: Dotnet Tool Restore | |
shell: pwsh | |
run: dotnet tool restore | |
- name: Dotnet restore | |
shell: pwsh | |
run: dotnet restore | |
- name: Dotnet Cake CI | |
shell: pwsh | |
run: dotnet cake --target=CI | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifacts | |
path: "./artifacts" | |
test-tool: | |
name: Test Tool (${{ matrix.os }}) | |
needs: build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Install .NET Core SDK | |
uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
path: "./artifacts" | |
- name: Install AtlasEF | |
shell: pwsh | |
run: dotnet tool install --prerelease --add-source ./artifacts atlas-ef | |
- name: Print SQL from Demo project | |
shell: pwsh | |
working-directory: ./src/Atlas.Provider.Demo | |
run: dotnet atlas-ef -- sqlserver | |
test: | |
name: Test (${{ matrix.os }}) | |
needs: build | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Install .NET Core SDK | |
uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.x | |
8.0.x | |
- name: Dotnet Tool Restore | |
shell: pwsh | |
run: dotnet tool restore | |
- name: Dotnet restore | |
shell: pwsh | |
run: dotnet restore | |
- name: Dotnet Cake Test | |
shell: pwsh | |
run: dotnet cake --target=Test | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-artifacts ( ${{ matrix.os }} ) | |
path: "./artifacts/**/*.xml" | |
publish-test-results: | |
name: Publish Tests Results | |
needs: test | |
if: always() | |
permissions: | |
checks: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: "./artifacts" | |
- name: Publish Test Summary | |
uses: test-summary/action@v2 | |
if: always() | |
with: | |
paths: "./artifacts/*/*.xml" | |
push-github-packages: | |
name: Push GitHub Packages | |
needs: test | |
if: github.event_name == 'release' || github.ref == 'refs/heads/master' | |
environment: | |
name: GitHub Packages | |
url: https://github.com/${{ github.repository }}/packages | |
permissions: | |
packages: write | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: Dotnet NuGet Add Source | |
shell: pwsh | |
run: | | |
dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json ` | |
--name GitHub --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} | |
- name: Dotnet NuGet Push | |
shell: pwsh | |
run: dotnet nuget push .\*.nupkg --api-key ${{ github.token }} --source GitHub --skip-duplicate | |
push-nuget: | |
name: Push NuGet Packages | |
needs: test | |
if: github.event_name == 'release' | |
environment: | |
name: NuGet | |
url: https://www.nuget.org/packages/atlas-ef | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: build-artifacts | |
- name: Dotnet NuGet Push | |
shell: pwsh | |
run: | | |
Get-ChildItem .\ -Filter *.nupkg | | |
Where-Object { !$_.Name.Contains('preview') } | | |
ForEach-Object { | |
dotnet nuget push $_ --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
} |