Manual release #7
Workflow file for this run
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: Manual release | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
versionSuffix: | |
description: 'Version suffix' | |
required: false | |
default: '' | |
jobs: | |
build: | |
timeout-minutes: 10 | |
runs-on: 'windows-2022' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: versionSuffix | |
shell: pwsh | |
run: | | |
$versionSuffix = '${{ github.event.inputs.versionSuffix }}' | |
If([string]::IsNullOrEmpty($versionSuffix)) | |
{ | |
$versionSuffix = '${{ github.ref_name }}' | |
} | |
$versionSuffix = '-' + ($versionSuffix -replace '[^a-zA-Z0-9]','-') | |
If($versionSuffix -eq '-release') | |
{ | |
$versionSuffix = '' | |
} | |
If(('-', '-master', '-main') -eq $versionSuffix) | |
{ | |
$versionSuffix = '-prerelease' | |
} | |
echo "versionSuffix=$versionSuffix" | Out-File -FilePath $Env:GITHUB_ENV -Append | |
- name: Get version number | |
shell: pwsh | |
run: | | |
If([string]::IsNullOrEmpty({{ env.versionSuffix }})) | |
{ | |
# No suffix. Fine. | |
$versionNumber = Get-Date -Format "yy.M.${{ github.run_number }}" | |
} | |
else | |
{ | |
# Suffix; ensure we add .0 in version number to stop them appearing above full releases. | |
$versionNumber = Get-Date -Format "yy.M.0.${{ github.run_number }}" | |
} | |
echo "versionNumber=$versionNumber${{ env.versionSuffix }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Write release notes | |
shell: pwsh | |
run: | | |
$lastTag = git describe --tags --abbrev=0 | |
$cmd = "git log --pretty=""format:%nhttps://github.com/M-Files/VAF.Extensions.Community/commit/%H%n%B"" --max-count=50 --date-order --no-merges $lastTag..@" | |
$changes = cmd /c $cmd | |
Add-Content -Path "release-notes.txt" -Value "Changes included in ${{ env.versionNumber }}" | |
Add-Content -Path "release-notes.txt" -Value $changes | |
- name: Setup MSBuild path | |
uses: microsoft/[email protected] | |
with: | |
vs-version: '[17.0,)' | |
- name: Setup dot net | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Create nuget package | |
run: dotnet pack ./MFiles.VAF.Extensions/MFiles.VAF.Extensions.csproj --configuration Release -p:Version=${{ env.versionNumber }} | |
# Tests cannot be run as MFAPI is not installed. | |
# - name: Test | |
# run: dotnet test --no-restore --verbosity normal | |
- name: Push with dotnet | |
run: dotnet nuget push ./MFiles.VAF.Extensions/bin/Release/MFiles.VAF.Extensions.${{ env.versionNumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
- name: Create release | |
id: createRelease | |
uses: ncipollo/release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
artifactErrorsFailBuild: true | |
artifacts: "./MFiles.VAF.Extensions/bin/Release/MFiles.VAF.Extensions.${{ env.versionNumber }}.nupkg" | |
name: ${{ env.versionNumber }} | |
tag: ${{ env.versionNumber }} | |
draft: false | |
omitBody: true | |
prerelease: ${{ env.versionSuffix == '' }} |