Update to 0.10.2 #214
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: ubuntu-20.04 | |
os: ubuntu-20.04 | |
uploader: true | |
cache_dependencies: true | |
- name: osx_11.0-x86_64 | |
os: macos-11.0 | |
cache_dependencies: true | |
- name: win-x86_64 | |
os: windows-latest | |
cache_dependencies: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-breaker3-${{ hashFiles('**/packages.lock.json') }} | |
if: matrix.cache_dependencies | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Upload planned for Nuget.org? | |
run: echo "This runner will upload to Nuget.org if tests pass" | |
if: matrix.uploader && github.event_name == 'release' && steps.version.outputs.is_valid == 'true' | |
- name: Set the release version (if applicable) | |
run: | | |
echo "TAGGED_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV | |
echo "ARTIFACT_VERSION=${{ steps.version.outputs.full_without_prefix }}" >> $GITHUB_ENV | |
echo Set version to ${{ steps.version.outputs.full_without_prefix }} | |
shell: bash | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' | |
# If ARTIFACT_VERSION is empty, then we're not on a release, so we'll use the commit hash | |
- name: Set the artifact version if not a release | |
run: | | |
echo "ARTIFACT_VERSION=commit-${{ github.sha }}" >> $GITHUB_ENV | |
echo Set ARTIFACT_VERSION to commit-${{ github.sha }} | |
shell: bash | |
if: steps.version.outputs.is_valid == 'false' || github.event_name != 'release' | |
- name: Set the Imageflow.Server.Host zip file name | |
run: | | |
echo "HOST_ZIP_FILE=Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip" >> $GITHUB_ENV | |
echo Set HOST_ZIP_FILE to ${{ env.HOST_ZIP_FILE }} | |
shell: bash | |
- name: Check .NET versions available to see if we can skip install | |
shell: bash | |
run: | | |
echo "DOTNET_VERSION_LIST<<EOF" >> $GITHUB_ENV | |
dotnet --list-sdks >> $GITHUB_ENV | |
echo "EOF" >> $GITHUB_ENV | |
- name: Setup .NET 6.0.x and 7.0.x | |
uses: actions/setup-dotnet@v2 | |
if: contains(env.DOTNET_VERSION_LIST, '6.0') == 'false' || contains(env.DOTNET_VERSION_LIST, '7.0.') == 'false' | |
with: | |
dotnet-version: | | |
6 | |
7 | |
- name: Clear & clean on release or cache miss | |
run: | | |
dotnet clean --configuration Release | |
dotnet nuget locals all --clear | |
if: steps.cache.outputs.cache-hit != 'true' || github.event_name == 'release' | |
- name: Restore packages | |
run: dotnet restore --force-evaluate | |
- name: Build | |
run: dotnet build --maxcpucount:1 -c Release | |
- name: Test | |
run: dotnet test -c Release --blame --no-build | |
- uses: actions/upload-artifact@v3 | |
if: failure() | |
with: | |
name: TestResults-${{matrix.os}}-${{ env.ARTIFACT_VERSION }} | |
path: TestResults/ | |
- name: Publish Host App | |
run: dotnet publish -c Release -o host/publish/ src/Imageflow.Server.Host/Imageflow.Server.Host.csproj | |
# Zip the contents of folder host/publish/ into host/Imageflow.Server.Host-${{matrix.os}}-${{ env.ARTIFACT_VERSION }}.zip | |
- name: Zip Server.Host | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
directory: 'host/publish/' | |
filename: '../${{env.HOST_ZIP_FILE}}' | |
path: '.' | |
# Upload the publish folder for src/Imageflow.Server.Host to the release artifacts | |
- name: Upload Imageflow.Server.Host to artifacts | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: ${{env.HOST_ZIP_FILE}} | |
path: host/${{env.HOST_ZIP_FILE}} | |
# If this is a release, upload it to the github release page using the git | |
- name: Upload Imageflow.Server.Host to release | |
uses: Shopify/[email protected] | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' | |
with: | |
name: ${{env.HOST_ZIP_FILE}} | |
path: host/${{env.HOST_ZIP_FILE}} | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
content-type: application/zip | |
- name: Pack | |
run: dotnet pack -c Release --include-source | |
- name: Publish NuGet packages to Nuget.org | |
if: steps.version.outputs.is_valid == 'true' && github.event_name == 'release' && matrix.uploader | |
run: | | |
dotnet nuget push bin/Release/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source nuget.org |