mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-21 01:39:32 +00:00
142 lines
4.3 KiB
YAML
142 lines
4.3 KiB
YAML
name: "Build test deploy"
|
|
|
|
env:
|
|
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
|
DOTNET_CORE_SDK_VERSION: 3.1.301
|
|
SOLUTION_PATH: './src/dotnet/MonoGame.Extended.sln'
|
|
MYGET_ACCESS_TOKEN: ${{ secrets.MYGET_ACCESS_TOKEN }}
|
|
MYGET_SOURCE_URL: 'https://www.myget.org/F/lithiumtoast/api/v3/index.json'
|
|
|
|
on:
|
|
push:
|
|
branches: [master, develop]
|
|
tags: [v*]
|
|
pull_request:
|
|
branches: [master, develop]
|
|
repository_dispatch:
|
|
#HACK: This allows to re-run the workflow from an external API call; useful for testing/debugging the workflow without having to commit a change in a branch
|
|
types: [run]
|
|
|
|
jobs:
|
|
|
|
gitversion-job:
|
|
name: "GitVersion"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: "Checkout Git repository"
|
|
uses: actions/checkout@v2
|
|
|
|
- name: "Fetch all history for all tags and branches"
|
|
run: git fetch --prune --unshallow
|
|
|
|
- name: "Install GitVersion"
|
|
uses: gittools/actions/gitversion/setup@v0.9.6
|
|
env:
|
|
ACTIONS_ALLOW_UNSECURE_COMMANDS: true # workaround for https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ until the execute action is updated
|
|
with:
|
|
versionSpec: '5.x'
|
|
|
|
- name: "Use GitVersion"
|
|
uses: gittools/actions/gitversion/execute@v0.9.6
|
|
|
|
- run: echo "$GitVersion_NuGetVersionV2" >> nuget-version.txt
|
|
|
|
- name: 'Upload NuGetVersion version artifact'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: nuget-version
|
|
path: nuget-version.txt
|
|
|
|
build-test-pack-job:
|
|
name: "Build"
|
|
needs: [gitversion-job]
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, macos-latest, ubuntu-latest]
|
|
|
|
steps:
|
|
|
|
- name: "Download version artifact"
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: nuget-version
|
|
|
|
- name: "Read Version"
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
echo "VERSION=$(cat nuget-version.txt)" >> $GITHUB_ENV
|
|
|
|
- name: "Print Version"
|
|
shell: bash
|
|
run: |
|
|
echo $VERSION
|
|
|
|
- name: "Checkout repository"
|
|
uses: actions/checkout@master
|
|
with:
|
|
submodules: true
|
|
lfs: true
|
|
|
|
- name: "Setup .NET Core CLI"
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: '${{ env.DOTNET_CORE_SDK_VERSION }}'
|
|
|
|
- name: "Install fonts (Ubuntu)"
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | sudo debconf-set-selections
|
|
sudo apt-get install -y ttf-mscorefonts-installer
|
|
sudo apt-get install -y fontconfig
|
|
sudo fc-cache -f -v
|
|
sudo fc-match Arial
|
|
|
|
- name: "Install dependencies"
|
|
run: dotnet restore '${{ env.SOLUTION_PATH }}' --verbosity quiet
|
|
|
|
- name: "Build solution"
|
|
run: dotnet build '${{ env.SOLUTION_PATH }}' --nologo --verbosity minimal --configuration Release --no-restore /p:Version='${{ env.VERSION }}'
|
|
|
|
- name: "Test solution"
|
|
run: dotnet test '${{ env.SOLUTION_PATH }}' --nologo --verbosity normal --configuration Release --no-build
|
|
|
|
- name: "Pack solution"
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: dotnet pack '${{ env.SOLUTION_PATH }}' --nologo --output "./nuget-packages-packed" --verbosity minimal --configuration Release --no-build -p:PackageVersion='${{ env.VERSION }}'
|
|
|
|
- name: "Upload packages"
|
|
if: matrix.os == 'ubuntu-latest'
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: nuget-packages-packed
|
|
path: './nuget-packages-packed/*/**'
|
|
|
|
deploy-job:
|
|
name: "Deploy"
|
|
needs: [build-test-pack-job]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: "Setup .NET Core CLI"
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: '${{ env.DOTNET_CORE_SDK_VERSION }}'
|
|
|
|
- name: "Download NuGet Packages"
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: nuget-packages-packed
|
|
path: './nuget-packages-packed'
|
|
|
|
- name: "Echo Packages"
|
|
run: find ./nuget-packages-packed/ -not -type d -exec basename {} \;
|
|
|
|
- name: "Add Packages Source: MyGet"
|
|
run: dotnet nuget add source $MYGET_SOURCE_URL --name "MyGet"
|
|
|
|
- name: "Upload Packages: MyGet"
|
|
run: dotnet nuget push "./**/*.nupkg" --source "MyGet" --skip-duplicate --api-key $MYGET_ACCESS_TOKEN |