Skip to content

*fix for supplementary files not appearing (#219) #4

*fix for supplementary files not appearing (#219)

*fix for supplementary files not appearing (#219) #4

name: Build-and-package-release-workflow
on:
push:
tags:
- 'v*'
jobs:
Build-and-package-release:
runs-on: windows-latest
steps:
- uses: actions/checkout@master
- name: Infer the version from the github ref
id: inferVersion
run: |
$prefix = "refs/tags/v"
if (!${env:GITHUB_REF}.StartsWith($prefix))
{
throw "Unexpected GITHUB_REF: ${env:GITHUB_REF}"
}
$version = ${env:GITHUB_REF}.Substring($prefix.Length)
Write-Host "The version is: $version"
if ($version.Contains("'"))
{
throw "Unexpected version containing a single quote: $version"
}
if ($version.Contains('"'))
{
throw "Unexpected version containing a double quote: $version"
}
if ($version.Contains(':'))
{
throw "Unexpected version containing a full colon: $version"
}
Write-Output "::set-output name=version::$version"
- name: Install .NET core 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: '6.0.x'
- name: Install the build dependencies
working-directory: src
run: powershell .\InstallBuildDependencies.ps1
- name: Build for the release
working-directory: src
run: powershell .\BuildForRelease.ps1
- name: Package the release
working-directory: src
run: |
$version = '${{ steps.inferVersion.outputs.version }}'
Write-Host "Packaging for the release version: $version"
powershell .\PackageRelease.ps1 -version $version
- name: Rename the release assets
working-directory: ./
run: |
Write-Host "Current working directory: $(Get-Location)"
$version = '${{ steps.inferVersion.outputs.version }}'
$releaseDir = Join-Path $(Get-Location) "artefacts\release\$version"
Write-Host "Release directory: $releaseDir"
if (!(Test-Path $releaseDir))
{
throw "The release directory does not exist: $releaseDir"
}
$archives = Get-ChildItem $releaseDir -Filter *.zip
foreach($archive in $archives)
{
$path = $archive.FullName
Write-Host "The path to the archive is: $path"
$nameWoExt = [io.path]::GetFileNameWithoutExtension($path)
Write-Host "The name without extension is: $nameWoExt"
$target = Join-Path $releaseDir ($nameWoExt + "." + $version + ".zip")
Write-Host "Moving: $path -> $target"
Move-Item -Path $path -Destination $target
}
- name: Upload the release assets
uses: AButler/upload-release-assets@v2.0
with:
files: "artefacts/release/${{ steps.inferVersion.outputs.version }}/*.zip"
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: "v${{ steps.inferVersion.outputs.version }}"