-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (120 loc) · 4.82 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
name: build
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
on:
push:
branches: [ "master" ]
tags:
- '*'
pull_request:
branches: [ "master" ]
env:
PACKAGE_DIRECTORY: color-picker
PACKAGE_NAME: color-picker
BUILD_CONFIGURATION: RelWithDebInfo
BUILD_DIRECTORY: "build"
DISTRIBUTE_DIRECTORY: "distribute"
RELEASE_BUCKET: "obs-studio-deployment"
ELECTRON_VERSION: "v25.8.0"
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 ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
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'
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
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 }}-win64
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 }}-win64