Skip to content

Move to ubuntu-latest #123

Move to ubuntu-latest

Move to ubuntu-latest #123

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
tags:
- 'v*.*.*'
pull_request:
branches: [ main ]
env:
DOTNET_NOLOGO: true
DOTNET_VERSION: 7.0.x
SLN: ${{ github.workspace }}/src/git-istage.sln
BIN: ${{ github.workspace }}/bin/
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # We need the full history in order to use Git versioning
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore
run: dotnet restore ${{ env.SLN }}
- name: Test
run: dotnet test --no-restore --nologo -c Debug --verbosity minimal ${{ env.SLN }}
publish:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # We need the full history in order to use Git versioning
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore
run: dotnet restore $SLN
- name: Publish
run: dotnet publish --no-restore --nologo -c Release $SLN /p:OutDir=$BIN
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: published-build
path: ${{ env.BIN }}
upload-gpr:
runs-on: ubuntu-latest
needs: publish
if: github.event_name == 'push' && github.ref_name == 'main'
steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: published-build
path: ${{ env.BIN }}
- name: Push package to GPR
run: dotnet nuget push $BIN*.nupkg --source https://nuget.pkg.github.com/terrajobst/index.json --api-key ${{ github.token }} --skip-duplicate
upload-nuget:
runs-on: ubuntu-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download build
uses: actions/download-artifact@v3
with:
name: published-build
path: ${{ env.BIN }}
- name: Push package to nuget.org
run: dotnet nuget push $BIN*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_ORG_TOKEN }} --skip-duplicate