Merge pull request #1 from PrincipleStudios/vite-development-server #8
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: All packages build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: | |
- '**/*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/workflows/parts/cache/ | |
########### | |
# BUILD | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: | | |
if [[ $VERSION_SUFFIX ]]; then | |
VERSION_SUFFIX_PARAM="--version-suffix sha.$VERSION_SUFFIX" | |
else | |
VERSION_SUFFIX_PARAM='' | |
fi | |
dotnet build --no-restore --configuration Release ${VERSION_SUFFIX_PARAM} | |
env: | |
VERSION_SUFFIX: ${{ github.ref != 'refs/heads/main' && github.sha || '' }} | |
########### | |
# TEST | |
- name: Test | |
run: dotnet test --no-build --verbosity normal --configuration Release --collect:"XPlat Code Coverage" | |
# - name: 'Upload Code Coverage' | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: code-coverage | |
# path: ./lib/*/TestResults/*/coverage.cobertura.xml | |
# retention-days: 7 | |
# - name: Record code coverage | |
# uses: 5monkeys/cobertura-action@master | |
# with: | |
# path: ./lib/*/TestResults/*/coverage.cobertura.xml | |
# repo_token: ${{ secrets.GITHUB_TOKEN }} | |
# minimum_coverage: 90 | |
# fail_below_threshold: false | |
########### | |
# PUBLISH | |
- name: Publish NuGet packages to GitHub registry if new version number | |
if: ${{ github.ref != 'refs/heads/main' }} | |
run: dotnet nuget push ./artifacts/packages/Release/*.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json --skip-duplicate --no-symbols | |
continue-on-error: true # Dependabot and other outside contributors can't push to our GitHub packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish NuGet packages to NuGet registry if new version number | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: dotnet nuget push ./artifacts/packages/Release/*.nupkg -k ${NUGET_API_KEY} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |