| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- ################################################################################
- ### Build MonoGame.Extended (Release)
- ### Clones a specified release tag or the `develop` 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 specified
- ### package source (GitHub or NuGet).
- ###
- ### - Can be triggered manually with workflow_dispatch
- ### - Allows specifying a release tag or defaults to develop branch
- ### - Allows choosing between GitHub Packages or NuGet as deployment target
- ################################################################################
- name: "Create Release"
- on:
- workflow_dispatch:
- inputs:
- source-feed:
- description: 'Which source feed to publish to?'
- required: true
- type: choice
- options:
- - GitHub
- - NuGet
- default: 'GitHub'
- release-tag:
- description: 'Release tag to build from (e.g., v1.0.0). Leave empty to use develop branch.'
- required: false
- type: string
- default: ''
- jobs:
- build:
- name: "Build MonoGame.Extended"
- runs-on: ubuntu-latest
- steps:
- - name: Clone Repository
- uses: actions/checkout@v4
- with:
- ref: ${{ inputs.release-tag || 'develop' }}
- - name: Setup Dotnet
- uses: actions/setup-dotnet@v4
- with:
- dotnet-version: 8.0.x
- - name: Setup xvfb
- run: |
- sudo apt-get update
- sudo apt-get install -y xvfb
- - name: Build MonoGame.Extended
- run: dotnet build MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release
- - name: Test MonoGame.Extended
- run: |
- xvfb-run -a -s "-screen 0 1024x768x24" dotnet test MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release
- - name: Pack MonoGame.Extended
- run: dotnet pack MonoGame.Extended.sln --nologo --verbosity minimal --configuration Release
- - name: Pack Kni.Extended
- run: dotnet pack KNI.Extended.sln --nologo --verbosity minimal --configuration Release
- - name: Upload Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: build-artifacts
- path: ./.artifacts/source/package/release/*.nupkg
- deploy:
- name: "Deploy NuGets"
- runs-on: ubuntu-latest
- needs: [ build ]
- permissions:
- packages: write
- contents: write
- steps:
- - name: "Download Artifacts"
- uses: actions/download-artifact@v4
- with:
- name: build-artifacts
- path: ./.artifacts
- - name: "Push Packages"
- env:
- SOURCE_URL: ${{ inputs.source-feed == 'GitHub' && 'https://nuget.pkg.github.com/craftworkgames/index.json' || inputs.source-feed == 'NuGet' && 'https://api.nuget.org/v3/index.json' }}
- API_KEY: ${{ inputs.source-feed == 'GitHub' && secrets.GITHUB_TOKEN || inputs.source-feed == 'NuGet' && secrets.NUGET_ACCESS_TOKEN }}
- run: |
- PACKAGES=(".artifacts/*.nupkg")
- for PACKAGE in "${PACKAGES[@]}"; do
- dotnet nuget push "$PACKAGE" --source "$SOURCE_URL" --skip-duplicate --api-key "$API_KEY"
- done
|