CI/CD Workflow #83
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
# Adapted from: https://github.com/giraffe-fsharp/Giraffe/blob/master/.github/workflows/build.yml | |
name: CI/CD Workflow | |
on: | |
pull_request: | |
paths: | |
- 'src/**' | |
- 'Version.xml' | |
release: | |
types: | |
- published | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
# GitHub Packages Feed settings | |
GITHUB_FEED: https://nuget.pkg.github.com/yv989c/index.json | |
GITHUB_USER: yv989c | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
LOCAL_NUGET_PAT: ${{ secrets.LOCAL_NUGET_PAT }} | |
# Official NuGet Feed settings | |
NUGET_FEED: https://api.nuget.org/v3/index.json | |
NUGET_USER: yv989c | |
NUGET_TOKEN: ${{ secrets.NUGET_KEY }} | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Restore | |
run: dotnet restore BlazarTech.QueryableValues.sln | |
- name: Test All | |
run: dotnet test BlazarTech.QueryableValues.sln -c Test_All --no-restore | |
- name: PreRelease-Pack | |
if: github.event_name != 'release' | |
run: dotnet build BlazarTech.QueryableValues.SqlServer.sln -c Release --no-restore --version-suffix=build.$env:GITHUB_RUN_NUMBER | |
- name: Release-Pack | |
if: github.event_name == 'release' | |
run: dotnet build BlazarTech.QueryableValues.SqlServer.sln -c Release --no-restore | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nupkg | |
path: ./src/QueryableValues.SqlServer.EFCore*/bin/Release/*.nupkg | |
prerelease: | |
needs: build | |
if: github.ref == 'refs/heads/develop' | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
- name: Push to GitHub Feed | |
run: | | |
dotnet nuget add source --username $env:GITHUB_USER --password $env:GITHUB_TOKEN --store-password-in-clear-text --name github "$env:GITHUB_FEED" && | |
dotnet nuget push "**/*.nupkg" --api-key $env:LOCAL_NUGET_PAT --source github --skip-duplicate | |
deploy: | |
needs: build | |
if: github.event_name == 'release' | |
runs-on: windows-latest | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: nupkg | |
- name: Push to GitHub Feed | |
run: | | |
dotnet nuget add source --username $env:GITHUB_USER --password $env:GITHUB_TOKEN --store-password-in-clear-text --name github "$env:GITHUB_FEED" && | |
dotnet nuget push "**/*.nupkg" --api-key $env:LOCAL_NUGET_PAT --source github --skip-duplicate | |
- name: Push to NuGet Feed | |
run: | | |
dotnet nuget push "**/*.nupkg" --api-key $env:NUGET_TOKEN --source $env:NUGET_FEED --skip-duplicate |