-
Notifications
You must be signed in to change notification settings - Fork 28
117 lines (117 loc) · 4.1 KB
/
build.yml
File metadata and controls
117 lines (117 loc) · 4.1 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Build and upload ReaKontrol for pushes or pull requests.
name: build
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize]
defaults:
run:
shell: bash
env:
VSCMD_SKIP_SENDTELEMETRY: 1
SCONS_CACHE_MSVC_CONFIG: 1
concurrency:
# There's no point continuing to run a build if it's already outdated by
# another commit.
group: build-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: set env
run: |
echo "CACHE_KEY=${RUNNER_OS}-${ImageVersion}" >> $GITHUB_ENV
if [ $GITHUB_EVENT_NAME == push ]; then
# For example: 2025.6.5.11,7041fcb6
echo version=`date +%Y.%-m.%-d`.$GITHUB_RUN_NUMBER,${GITHUB_SHA:0:8} >> "$GITHUB_ENV"
else
# For example: pr1234-101,7041fcb6
echo version=pr${{ github.event.number }}-$GITHUB_RUN_NUMBER,${GITHUB_SHA:0:8} >> "$GITHUB_ENV"
fi
if [ ${{ matrix.os }} == windows-latest ]; then
echo os=windows >> "$GITHUB_ENV"
else
echo os=mac >> "$GITHUB_ENV"
fi
- uses: actions/checkout@v4
with:
submodules: true
- name: setup
run: pip install scons
- name: SCons MSVC Cache
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/cache@v4
with:
path: ~\scons_msvc_cache.json
key: ${{ env.CACHE_KEY }}
- name: build
run: scons
# Normal artifacts are always zipped. We upload snapshot builds to GitHub
# Releases so they can be downloaded directly.
- name: zip Windows
if: ${{ github.event_name == 'push' && matrix.os == 'windows-latest' }}
run: cd build; 7z a -tzip -mx=9 reaKontrol_windows_$version.zip reaper_kontrol.dll
- name: zip Mac
if: ${{ github.event_name == 'push' && matrix.os == 'macos-latest' }}
run: cd build; zip -9 reaKontrol_mac_$version.zip reaper_kontrol.dylib
- id: uploadBuild
name: upload build
if: ${{ github.event_name == 'push' }}
uses: softprops/action-gh-release@v2
with:
files: build/*.zip
# We have a hacky release we reuse for snapshots, rather than
# creating a tag and a release for every snapshot.
tag_name: snapshots
- id: getBuildUrl
name: get build URL
if: ${{ github.event_name == 'push' }}
run: |
echo ${{ env.os }}Url=${{ fromJSON(steps.uploadBuild.outputs.assets)[0].browser_download_url }} >> "$GITHUB_OUTPUT"
# We upload pull request builds as normal artifacts.
- name: upload PR build
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4
with:
name: reaKontrol_${{ env.os }}_${{ env.version }}
path: |
build/reaper_kontrol.dll
build/reaper_kontrol.dylib
outputs:
version: ${{ env.version }}
# These will only be set for snapshot builds. Furthermore, each OS job
# will only set the output relevant to that OS. This is possible because
# outputs won't be set if the value is empty.
winInstallerUrl: ${{ steps.getBuildUrl.outputs.windowsUrl }}
macInstallerUrl: ${{ steps.getBuildUrl.outputs.macUrl }}
publish:
# This job updates the website with the new readme and snapshots.
if: ${{ github.event_name == 'push' }}
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: setup
run: pip install markdown
- uses: actions/checkout@v4
- name: build
env:
version: ${{ needs.build.outputs.version }}
winUrl: ${{ needs.build.outputs.winInstallerUrl }}
macUrl: ${{ needs.build.outputs.macInstallerUrl }}
run: python ci/buildSite
- name: upload
uses: actions/upload-pages-artifact@v3
with:
# ci/buildSite built the site in _site/.
path: _site/
- name: deploy
uses: actions/deploy-pages@v4