Skip to content

✨ Implement APIs to import sprites easily #60

✨ Implement APIs to import sprites easily

✨ Implement APIs to import sprites easily #60

name: Build and release
on:
# Dev
workflow_dispatch:
pull_request:
push:
# Preview
branches: [ main ]
# Stable
tags: [ "v*" ]
release:
types:
- published
env:
NET_SDK: '6.0.200'
jobs:
build_main:
name: "[ubuntu-latest] Build, test and stage"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number
- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}
- name: "Install build tools"
run: dotnet tool restore
- name: "Generate release notes"
run: dotnet cake --target=Generate-ReleaseNotes --verbosity=diagnostic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Build, test and stage"
run: dotnet cake --target=Stage-Artifacts --configuration=Release --verbosity=diagnostic
- name: "Publish test results"
uses: actions/upload-artifact@v2
with:
name: "Test results"
path: "./artifacts/test_results"
retention-days: 1
- name: "Publish artifacts to CI"
uses: actions/upload-artifact@v2
with:
name: "Artifacts"
path: |
./artifacts/*.zip
./artifacts/*.nupkg
./artifacts/*.snupkg
retention-days: 2
build_sec:
name: "[${{ matrix.os }}] Build and test"
strategy:
matrix:
os: [ macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number
- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}
- name: "Install build tools"
run: dotnet tool restore
# No need to stage as one job can create the binaries for all platforms
- name: "Build and test"
run: dotnet cake --target=BuildTest --configuration=Release --verbosity=diagnostic
# Preview release on push to main only
# Stable release on version tag push only
push_artifacts:
name: "Push artifacts"
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
needs: [ "build_main", "build_sec" ]
runs-on: ubuntu-latest
env:
# Needed only for Azure DevOps Artifacts due to its weird auth method.
NUGET_FEED: 'https://pkgs.dev.azure.com/SceneGate/SceneGate/_packaging/SceneGate-Preview/nuget/v3/index.json'
steps:
- name: "Checkout"
uses: actions/checkout@v2
with:
fetch-depth: 0 # We need full history for version number
- name: "Download artifacts"
uses: actions/download-artifact@v2
with:
name: "Artifacts"
path: "./artifacts"
- name: "Setup .NET SDK"
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.NET_SDK }}
- name: "Install build tools"
run: dotnet tool restore
# Weird way to authenticate in Azure DevOps Artifacts
# Then, we need to setup VSS_NUGET_EXTERNAL_FEED_ENDPOINTS
- name: "Install Azure Artifacts Credential Provider"
run: wget -qO- https://aka.ms/install-artifacts-credprovider.sh | bash
- name: "Publish artifacts"
run: dotnet cake --target=Push-Artifacts --verbosity=diagnostic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
STABLE_NUGET_FEED_TOKEN: "az"
PREVIEW_NUGET_FEED_TOKEN: "az" # Dummy, auth via below env var
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: '{"endpointCredentials": [{"endpoint":"${{ env.NUGET_FEED }}", "username":"", "password":"${{ secrets.PREVIEW_NUGET_FEED_TOKEN }}"}]}'