-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (94 loc) · 3.86 KB
/
ManualReleaseMain.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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