Skip to content

Manual Release - Main #1

Manual Release - Main

Manual Release - Main #1

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
MSYSTEM: clang64
ARCH: clang-x86_64
jobs:
Build:
name: Build w/ MSYS2
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- name: Setup MSYS2 ${{ env.MSYSTEM }} (${{ env.ARCH }})
uses: msys2/setup-msys2@v2
with:
msystem: ${{ env.MSYSTEM }}
release: false
update: true
cache: true
install: git base-devel mingw-w64-${{ env.ARCH }}-toolchain mingw-w64-${{ env.ARCH }}-cmake
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- 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
- name: Run CMake
shell: msys2 {0}
env:
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
shell: msys2 {0}
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}}
run: |
Add-Type -assembly 'System.IO.Compression'
Add-Type -assembly 'System.IO.Compression.FileSystem'
[System.IO.Compression.ZipArchive]$zipFile = [System.IO.Compression.ZipFile]::Open('SRTManager-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/SRTManager.exe', 'SRTManager.exe')
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zipFile, 'build/SRTManager.dll', 'SRTManager.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: |
SRTManager-v${{inputs.versionMajor}}.${{inputs.versionMinor}}.${{inputs.versionPatch}}-${{steps.build-number.outputs.current_build_number}}-${{inputs.workflowPreset}}.zip