Skip to content

Increment version number #58

Increment version number

Increment version number #58

Workflow file for this run

on:
pull_request:
push:
branches: [main]
tags: ["v*"]
env:
DOTNET_VERSION: "7.0.x"
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: dotnet restore
run: dotnet restore src/TutorBot.sln
- name: dotnet build
run: dotnet build src/TutorBot.sln
- name: dotnet test
run: dotnet test src/TutorBot.Tests/TutorBot.Tests.csproj --no-restore --verbosity normal
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: dotnet restore
run: dotnet restore src/TutorBot.sln
- name: dotnet build
run: dotnet build src/TutorBot.sln
- name: dotnet publish
run: |
dotnet publish src/TutorBot.Cli/TutorBot.Cli.csproj --configuration Release --self-contained --runtime win-x64 -p:PublishSingleFile=true --output dist/win-x64 -p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish src/TutorBot.Cli/TutorBot.Cli.csproj --configuration Release --self-contained --runtime linux-x64 -p:PublishSingleFile=true --output dist/linux-x64 -p:IncludeNativeLibrariesForSelfExtract=true
- name: prepare staging
run: |
mkdir -p ${{ runner.temp }}/staging
cp dist/win-x64/gh-tutorbot.exe ${{ runner.temp }}/staging/tutorbot-windows-amd64.exe
cp dist/linux-x64/gh-tutorbot ${{ runner.temp }}/staging/tutorbot-linux-amd64
- name: publish artifacts
uses: actions/upload-artifact@v3
with:
name: executables
path: ${{ runner.temp }}/staging/*
publish:
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
environment: create_release
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: validate tag on main
shell: pwsh
run: |
git checkout main
$mainsha = $(git show-ref refs/heads/main --hash)
$tagsha = $(git show-ref ${{ github.ref }} --hash)
Write-Output "refs/heads/main: $mainsha"
Write-Output "${{ github.ref }}: $tagsha"
if ($mainsha -ne $tagsha) {
Write-Error "tag must match HEAD of main"
exit 1
}
- name: download artifacts
uses: actions/download-artifact@v3
with:
name: executables
path: ${{ runner.temp }}/dist
- name: create release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ runner.temp }}/dist/tutorbot-windows-amd64.exe
${{ runner.temp }}/dist/tutorbot-linux-amd64