Manual Release - Main #72
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 - Main" | |
on: | |
workflow_dispatch: | |
inputs: | |
workflowPreset: | |
description: "Configure/Build/Test/Package configuration" | |
required: false | |
default: "Release" | |
type: choice | |
options: | |
- "Release" | |
- "RelWithDebInfo" | |
- "MinSizeRel" | |
- "Debug" | |
versionMajor: | |
description: "Major Version" | |
required: false | |
default: 0 | |
type: number | |
versionMinor: | |
description: "Minor Version" | |
required: false | |
default: 1 | |
type: number | |
versionPatch: | |
description: "Patch Version" | |
required: false | |
default: 0 | |
type: number | |
env: | |
VCPKG_ROOT: C:/vcpkg | |
jobs: | |
Build: | |
name: "Build" | |
runs-on: windows-latest | |
steps: | |
- name: Get new build number | |
id: build-number | |
run: | | |
$build_number = $((${{ vars.BUILD_NUMBER }} + 1)) | |
echo "current_build_number=$build_number" | Set-Content $env:GITHUB_OUTPUT | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.ref }} | |
- uses: msys2/setup-msys2@v2 | |
with: | |
msystem: CLANG64 | |
release: false | |
update: true | |
install: git base-devel mingw-w64-clang-x86_64-toolchain mingw-w64-clang-x86_64-cmake | |
- name: Set PATH to include Clang64 from MSYS2 | |
run: | | |
$path1 = "C:/msys64/clang64/bin" | |
$path2 = "C:/msys64/usr/bin" | |
echo "$path1`n$path2`n$(Get-Content $env:GITHUB_PATH)" | Set-Content $env:GITHUB_PATH | |
- name: Run CMake | |
env: | |
CC: clang | |
CXX: clang++ | |
RC_VERSION_MAJOR: ${{inputs.versionMajor}} | |
RC_VERSION_MINOR: ${{inputs.versionMinor}} | |
RC_VERSION_PATCH: ${{inputs.versionPatch}} | |
RC_VERSION_BUILD: ${{steps.build-number.outputs.current_build_number}} | |
run: cmake --workflow --preset ${{inputs.workflowPreset}} --fresh | |
- name: Run CTest | |
env: | |
CC: clang | |
CXX: clang++ | |
run: ctest --preset ${{inputs.workflowPreset}} --output-on-failure | |
- name: Update build number variable | |
env: | |
GH_TOKEN: ${{ secrets.GH_VARIABLE_RW_TOKEN }} | |
run: gh variable set BUILD_NUMBER -b${{ steps.build-number.outputs.current_build_number }} | |
- name: Zip the publish artifacts | |
working-directory: ${{github.workspace}} | |
shell: pwsh | |
run: | | |
Add-Type -assembly 'System.IO.Compression' | |
Add-Type -assembly 'System.IO.Compression.FileSystem' | |
[System.IO.Compression.ZipArchive]$zipFile = [System.IO.Compression.ZipFile]::Open('RE2RRandomizer-v${{inputs.versionMajor}}.${{inputs.versionMinor}}.${{inputs.versionPatch}}-${{steps.build-number.outputs.current_build_number}}-${{inputs.workflowPreset}}.zip', ([System.IO.Compression.ZipArchiveMode]::Create)) | |
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'build/RE2RRandomizer.exe', 'RE2RRandomizer.exe') | |
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'build/RE2RRandomizerHook.dll', 'RE2RRandomizerHook.dll') | |
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'LICENSE', 'LICENSE') | |
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'README.md', 'README.md') | |
$zipFile.Dispose() | |
- name: Publish release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "${{inputs.workflowPreset}}-build" | |
prerelease: true | |
title: "Manual Build [main] - v${{inputs.versionMajor}}.${{inputs.versionMinor}}.${{inputs.versionPatch}}-${{steps.build-number.outputs.current_build_number}} Release" | |
files: | | |
RE2RRandomizer-v${{inputs.versionMajor}}.${{inputs.versionMinor}}.${{inputs.versionPatch}}-${{steps.build-number.outputs.current_build_number}}-${{inputs.workflowPreset}}.zip |