-
-
Notifications
You must be signed in to change notification settings - Fork 50
83 lines (73 loc) · 3.24 KB
/
Copy pathrelease.yml
File metadata and controls
83 lines (73 loc) · 3.24 KB
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
name: Build and publish a release
on:
# NOTE: We specifically do *not* support `workflow_dispatch` here, because if we run this from
# workflow_dispatch, it will create a tag & release named /refs/heads/master or similar.
# This is a pain to deal with and we can always just delete the tag and tag a later commit
# if we need to make fixes as part of the release process.
push:
tags:
- '*'
jobs:
run-tests:
uses: ./.github/workflows/run_tests.yml
build-release:
name: Build Release
runs-on: windows-2022
needs: run-tests
permissions:
contents: write # Needed to allow creating a release
steps:
- name: Add MSBuild to the PATH
uses: microsoft/setup-msbuild@v2
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all the history so that `git describe` works to generate the version header
fetch-tags: true
- name: Check that tag description matches the release version
continue-on-error: false # The C++ compilation uses `git describe HEAD` while the release creation uses the tag given by the Github Actions trigger, these should match
shell: bash
run: |
tag_description=$(git describe --tags --first-parent HEAD)
release_version="${GITHUB_REF#refs/tags/}"
echo "Checking tag description \"$tag_description\" against release version \"$release_version\"..."
if [ "$tag_description" == "$release_version" ]; then
echo "Release descriptions match, release can continue..."
else
echo "Release descriptions do NOT match, failing the release..."
exit 1
fi
- name: Build 32-bit binary
run: msbuild /r /m /p:Configuration=Release /p:Platform=x86 build\foo_openlyrics.sln
- name: Build 64-bit binary
run: msbuild /r /m /p:Configuration=Release /p:Platform=x64 build\foo_openlyrics.sln
- name: Pack binary into archive
shell: bash
run: |
release_version="${GITHUB_REF#refs/tags/}"
release_name="foo_openlyrics-${release_version}"
echo "Release version ${release_version}"
mkdir -p build_component_staging/x64
pushd build_component_staging
cp "../build/Release/foo_openlyrics.dll" "."
cp "../build/x64/Release/foo_openlyrics.dll" "x64/"
7z a -tzip "../${release_name}.fb2k-component" "."
popd
mkdir -p build_symbols_staging/x86
mkdir -p build_symbols_staging/x64
pushd build_symbols_staging
cp "../build/Release/foo_openlyrics.dll" "x86/"
cp "../build/Release/foo_openlyrics.pdb" "x86/"
cp "../build/x64/Release/foo_openlyrics.dll" "x64/"
cp "../build/x64/Release/foo_openlyrics.pdb" "x64/"
7z a "../${release_name}-with_debug_symbols.zip" "."
popd
echo "RELEASE_VERSION=${release_version}" >> $GITHUB_ENV
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.RELEASE_NAME }}.fb2k-component
${{ env.RELEASE_NAME }}-with_debug_symbols.zip