Skip to content

Create release

Create release #137

Workflow file for this run

name: Create release
on:
workflow_run:
workflows: ["Build and test"]
types:
- completed
branches:
- master
workflow_dispatch:
permissions:
contents: write
jobs:
build-windows:
name: Build Windows
runs-on: windows-latest
outputs:
version_nodots: ${{ steps.get_version.outputs.version_nodots }}
version_dotted: ${{ steps.get_version.outputs.version_dotted }}
if: >
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' && contains(github.event.workflow_run.head_commit.message, '[release]'))
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Publish (Windows)
shell: pwsh
run: dotnet publish ".\src\Avalonia.Desktop\Avalonia.Desktop.csproj" -p:PublishProfile=Windows -c Release -o ./publish
- name: Get version
id: get_version
shell: pwsh
run: |
$exe = Join-Path $PWD 'publish\BuildLauncher.exe'
if (-not (Test-Path $exe)) { Write-Error "Executable not found: $exe" }
$version = (Get-Item $exe).VersionInfo.FileVersion
$withDots = $version.Substring(0,$version.Length-2)
$withoutDots = $withDots.Replace('.','')
echo "version_dotted=$withDots" >> $env:GITHUB_OUTPUT
echo "version_nodots=$withoutDots" >> $env:GITHUB_OUTPUT
- name: Upload unsigned Windows artifact
id: upload-unsigned-artifact
uses: actions/upload-artifact@v4
with:
path: publish/BuildLauncher.exe
- name: Signing
uses: signpath/github-action-submit-signing-request@v1
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '645943cb-48f7-4758-a33d-7aad2a18e1a9'
project-slug: 'BuildLauncher'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: 'publish/signed/'
artifact-configuration-slug: 'zip'
- name: Zip Windows build
shell: pwsh
run: |
ls .\publish\signed\
$v = "${{ steps.get_version.outputs.version_nodots }}"
$dest = Join-Path $PWD "publish\signed\buildlauncher_${v}_win-x64.zip"
if (Test-Path $dest) { Remove-Item $dest }
Compress-Archive -Path ".\publish\signed\BuildLauncher.exe" -DestinationPath $dest
Write-Host "Created $dest"
- name: Upload signed Windows artifact
uses: actions/upload-artifact@v4
with:
name: buildlauncher-win
path: publish/signed/buildlauncher_${{ steps.get_version.outputs.version_nodots }}_win-x64.zip
release:
name: Create release
runs-on: ubuntu-latest
needs:
- build-windows
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: buildlauncher-win
path: publish/signed
- name: Create release (and upload assets)
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.build-windows.outputs.version_dotted}}
name: v${{ needs.build-windows.outputs.version_dotted }}
body: Automated release created by GitHub Actions.
artifacts: publish/**/*.zip
draft: false
prerelease: true