Skip to content

Merge pull request #191 from SceneGate/feature/new-converter-api #111

Merge pull request #191 from SceneGate/feature/new-converter-api

Merge pull request #191 from SceneGate/feature/new-converter-api #111

name: Build and release
on:
# Dev
workflow_dispatch:
pull_request:
push:
# Preview
branches: [ develop ]
# Stable
tags: [ "v*" ]
env:
NET_SDK: '6.0.406'
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-NewDocs --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 develop only
# Stable release on version tag push only
push_artifacts:
name: "Push artifacts"
if: github.ref == 'refs/heads/develop' || 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.
PREVIEW_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: ${{ secrets.STABLE_NUGET_FEED_TOKEN }}
PREVIEW_NUGET_FEED_TOKEN: "az" # Dummy, auth via below env var
VSS_NUGET_EXTERNAL_FEED_ENDPOINTS: '{"endpointCredentials": [{"endpoint":"${{ env.PREVIEW_NUGET_FEED }}", "username":"", "password":"${{ secrets.PREVIEW_NUGET_FEED_TOKEN }}"}]}'