-
Notifications
You must be signed in to change notification settings - Fork 10
88 lines (72 loc) · 2.7 KB
/
release.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
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Create Release
on:
release:
types:
- created
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: .
# Configuration type to build.
# You can convert this to a build matrix if you need coverage of multiple configuration types.
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
BUILD_CONFIGURATION: Release
TARGET_NAME: matrix
TARGET_EXT: .scr
VERSION_H: Matrix\\resource\\version.h
permissions:
contents: write
jobs:
build:
strategy:
matrix:
configuration: [Release]
platform: [x64, x86]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set variables
run:
echo "TARGET_PATH=bin\${{matrix.platform}}\${{matrix.configuration}}\${{env.TARGET_NAME}}${{env.TARGET_EXT}}"
"PACKAGE_NAME=./Matrix_${{matrix.configuration}}_${{matrix.platform}}.zip"
| Out-File -FilePath $env:GITHUB_ENV
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Increment version
shell: python
run: |
import os
import re
r = re.match(r'v(\d+)\.(\d+)\.(\d+)', '${{github.ref_name}}')
path = os.path.abspath("${{env.VERSION_H}}")
with open(path, "w") as f:
print("#define BUILD_MAJ", r.group(1), file=f)
print("#define BUILD_MIN", r.group(2), file=f)
print("#define BUILD_PAT", r.group(3), file=f)
print("#define BUILD_NUM", ${{github.run_number}}, file=f)
print("Writing: ", path)
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
# rename the destination binary using a comination of TargetName & TargetExt.
# setting TargetFileName directly does not work
run: msbuild /m
/p:TargetName=${{env.TARGET_NAME}}
/p:TargetExt=${{env.TARGET_EXT}}
/p:Configuration=${{matrix.configuration}}
/p:Platform=${{matrix.platform}} ${{env.SOLUTION_FILE_PATH}}
- name: Package
run:
$compress = @{
Path = "${{env.TARGET_PATH}}", "LICENSE", "README.md";
CompressionLevel = "Optimal";
DestinationPath = "${{env.PACKAGE_NAME}}"
};
Compress-Archive @compress
- name: Publish
run: gh release upload ${{github.ref_name}} ${{env.PACKAGE_NAME}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}