Skip to content

Mark versions starting with 0. as prerelease (#210) #7

Mark versions starting with 0. as prerelease (#210)

Mark versions starting with 0. as prerelease (#210) #7

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
jobs:
build-and-publish:
name: Build and Publish
runs-on: windows-2022
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup Visual Studio Development Environment
uses: compnerd/gha-setup-vsdevenv@main
- name: Install Swift
uses: compnerd/gha-setup-swift@81f383b35a86e6e966de139be25b451d4f7dd953 # The next main commit breaks our %Path%
with:
branch: swift-5.10.1-release
tag: 5.10.1-RELEASE
- name: CMake Configure
working-directory: Generator
shell: pwsh
run: cmake --preset release
- name: CMake Build
working-directory: Generator
shell: pwsh
run: cmake --build --preset release
- name: Compute Version
id: version
shell: pwsh
run: |
$TagName = "${{ github.event.push.tag_name }}"
if ($TagName.StartsWith("v")) { $SemVer = $TagName.Substring(1) }
else {
$CommitHash = "${{ github.sha }}".Substring(0, 7)
$SemVer = "0.0.0-$CommitHash"
}
echo "::set-output semver=$SemVer"
- name: Create NuGet Package
working-directory: Generator
shell: pwsh
run: |
& .\Create-NuGetPackage.ps1 `
-NativeExe "build\release\Sources\SwiftWinRT\SwiftWinRT.exe" `
-Version "${{ steps.version.outputs.semver }}" `
-OutputPath $OutputPath
(Get-FileHash $OutputPath).Hash | Out-File -FilePath $OutputPath.sha256
- name: Create GitHub Release
if: github.event_name == 'push'
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create Release
$TagName = "${{ github.event.push.tag_name }}"
$SemVer = "${{ steps.version.outputs.semver }}"
$RepositoryUrl = "${{ github.repository }}"
$PrereleaseArg = if ($SemVer.StartsWith("0.") -or $SemVer.Contains("-")) { @("--prerelease") } else { @() }
& gh release create $TagName --repo $RepositoryUrl --title $SemVer --generate-notes @PrereleaseArg
& gh release upload $TagName SwiftWinRT.nupkg --repo $RepositoryUrl
& gh release upload $TagName SwiftWinRT.nupkg.sha256 --repo $RepositoryUrl