forked from computerquip-streamlabs/font-manager
-
Notifications
You must be signed in to change notification settings - Fork 3
207 lines (198 loc) · 7.92 KB
/
build.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: build
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
on:
push:
branches: [ "streamlabs" ]
tags:
- '*'
pull_request:
branches: [ "streamlabs" ]
env:
PACKAGE_DIRECTORY: font-manager
PACKAGE_NAME: font-manager
BUILD_CONFIGURATION: RelWithDebInfo
BUILD_DIRECTORY: "build"
DISTRIBUTE_DIRECTORY: "distribute"
RELEASE_BUCKET: "slobs-font-manager"
ELECTRON_VERSION: "v25.8.2"
permissions:
contents: read
jobs:
build:
name: 'Build a package'
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Show GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies
run: yarn install --immutable --immutable-cache --check-cache
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Configure
run: cmake -H"${{ github.workspace }}" -B"${{env.BUILD_DIRECTORY}}" -G"Visual Studio 17 2022" -A x64 -DNODEJS_VERSION="${{env.ELECTRON_VERSION}}" -DCMAKE_INSTALL_PREFIX="${{env.INSTALL_PACKAGE_PATH}}"
env:
INSTALL_PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}"
- name: Build
run: cmake --build "${{env.BUILD_DIRECTORY}}" --target install --config ${{env.BUILD_CONFIGURATION}}
- name: Put version into package.json
if: startsWith(github.ref, 'refs/tags/')
run: node ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}"
env:
PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}"
- name: Cache build
uses: actions/cache@v3
with:
path: ${{env.BUILD_DIRECTORY}}
key: ${{ runner.os }}-build-${{ github.sha }}
upload_debug_symbols:
needs: build
name: 'Upload debug symbols'
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Get build from cache
id: cache-check
uses: actions/cache@v3
with:
path: ${{env.BUILD_DIRECTORY}}
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Check cache
if: steps.cache-check.outputs.cache-hit != 'true'
run: exit 1
- name: Fetch symsrv-scripts
uses: actions/checkout@v3
with:
fetch-depth: 2
repository: stream-labs/symsrv-scripts
path: symsrv-scripts
- name: Run symbol server scripts
run: ./symsrv-scripts/main.bat "${{ github.workspace }}/symsrv-scripts" ".\main.ps1 -localSourceDir '${{ github.workspace }}' -repo_userId 'stream-labs' -repo_name '${{env.PACKAGE_NAME}}' -repo_branch '${{ github.sha }}'"
env:
AWS_SYMB_ACCESS_KEY_ID: ${{secrets.AWS_SYMB_ACCESS_KEY_ID}}
AWS_SYMB_SECRET_ACCESS_KEY: ${{secrets.AWS_SYMB_SECRET_ACCESS_KEY}}
shell: powershell
upload_release_package:
needs: build
name: 'Upload release package win'
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
env:
OS_TAG: "win64"
steps:
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Get build from cache
id: cache-check
uses: actions/cache@v3
with:
path: ${{env.BUILD_DIRECTORY}}
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Check cache
if: steps.cache-check.outputs.cache-hit != 'true'
run: exit 1
- name: Tar artifact for deployment
run: tar -cvzf ${{env.TARGET_ARTIFACT}}.tar.gz -C ${{env.INSTALL_DISTRIBUTE_PATH}} ${{env.PACKAGE_DIRECTORY}}
env:
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}
INSTALL_DISTRIBUTE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
aws-region: us-west-2
- name: Deploy
run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read
env:
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}
build_macos:
name: 'Build a package MacOS'
runs-on: macos-latest
strategy:
matrix:
arch: ['x86_64', 'arm64']
steps:
- uses: actions/checkout@v3
- name: Show GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies
run: yarn install --immutable --immutable-cache --check-cache
- name: Build
run: './ci/build-osx.sh'
env:
SENTRY_AUTH_TOKEN: ${{secrets.SENTRY_AUTH_TOKEN}}
ARCHITECTURE: ${{matrix.arch}}
- name: Put version into package.json
if: startsWith(github.ref, 'refs/tags/')
run: node ./ci/bump-version.js "${{ steps.get_version.outputs.VERSION }}" "${{env.PACKAGE_PATH}}"
env:
PACKAGE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}/${{env.PACKAGE_DIRECTORY}}"
- name: Cache build
uses: actions/cache@v3
with:
path: ${{env.BUILD_DIRECTORY}}
key: ${{ runner.os }}-${{ matrix.arch }}-build-${{ github.sha }}
upload_release_package_macos:
needs: build_macos
name: 'Upload release package macos'
runs-on: macos-latest
strategy:
matrix:
arch: ['x86_64', 'arm64']
if: startsWith(github.ref, 'refs/tags/')
env:
OS_TAG: "osx"
steps:
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
shell: bash
- name: Get build from cache
id: cache-check
uses: actions/cache@v3
with:
path: ${{env.BUILD_DIRECTORY}}
key: ${{ runner.os }}-${{ matrix.arch }}-build-${{ github.sha }}
- name: Check cache
if: steps.cache-check.outputs.cache-hit != 'true'
run: exit 1
- name: Tar artifact for deployment
run: tar -cvzf ${{env.TARGET_ARTIFACT}}.tar.gz -C "${{env.INSTALL_DISTRIBUTE_PATH}}" ${{env.PACKAGE_DIRECTORY}}
env:
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}-${{ matrix.arch }}
INSTALL_DISTRIBUTE_PATH: "${{env.BUILD_DIRECTORY}}/${{env.DISTRIBUTE_DIRECTORY}}"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{secrets.AWS_RELEASE_ACCESS_KEY_ID}}
aws-secret-access-key: ${{secrets.AWS_RELEASE_SECRET_ACCESS_KEY}}
aws-region: us-west-2
- name: Deploy
run: aws s3 cp ${{env.TARGET_ARTIFACT}}.tar.gz s3://${{env.RELEASE_BUCKET}} --acl public-read
env:
TARGET_ARTIFACT: ${{env.PACKAGE_NAME}}-${{ steps.get_version.outputs.VERSION }}-${{env.OS_TAG}}-${{ matrix.arch }}