Files
MonoGame.Extended/.github/workflows/release-build.yml
T
2024-05-19 16:07:58 -04:00

71 lines
2.1 KiB
YAML

################################################################################
### Build MonoGame.Extended (Release)
### Clones the `main` branch and performs a build, test, then pack of the
### Monogame.Extended source code. Once the build job is finished, the deploy
### job will upload the nupkg files created to the MonoGame.Extended NuGet
### source.
###
### - Only runs when there is a new version release tag created.
################################################################################
name: "Build MonoGame.Extended (Release)"
on:
push:
tags:
- 'v*'
jobs:
build:
name: "Build MonoGame.Extended"
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
with:
ref: main
- name: Setup DotNet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Test MonoGame.Extended
run: dotnet test --nologo --verbosity minimal --configuration Release
- name: Build MonoGame.Extended
run: dotnet build --nologo --verbosity minimal --configuration Release
- name: Pack MonoGame.Extended
run: dotnet pack --nologo --verbosity minimal --configuration Release
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: ./.artifacts/source/package/release/*.nupkg
deploy-job:
name: "Deploy Nugets"
runs-on: ubuntu-latest
needs: [build]
permissions:
packages: write
contents: write
steps:
- name: "Download Artifacts For Deploy"
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./.artifacts
- name: "Push Packages"
run: |
PACKAGES=(".artifacts/*.nupkg")
for PACKAGE in "${PACKAGES[@]}"; do
dotnet nuget push "$PACKAGE" --source "github" --skip-duplicate --api-key "${{ env.GITHUB_TOKEN }}"
dotnet nuget push "$PACKAGE" --source "https://api.nuget.org/v3/index.json" --skip-duplicate --api-key "${{ secrets.NUGET_ACCESS_TOKEN }}"
done