-
-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (74 loc) · 2.13 KB
/
build-and-deploy.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
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12
# setup emscripten
- uses: actions/checkout@v2
with:
repository: 'emscripten-core/emsdk'
path: emsdk
- name: Cache emsdk zips
uses: actions/cache@v1
with:
path: emsdk/zips
key: v1-emsdk
- run: |
cd emsdk
./emsdk install sdk-1.39.13-64bit
./emsdk activate --embedded sdk-1.39.13-64bit
# build ffmpeg
- name: Cache FFmpeg binaries
id: cache-ffmpeg
uses: actions/cache@v1
with:
path: ffmpeg/built
key: v1-${{ hashFiles('ffmpeg/build-ffmpeg.sh') }}
- run: source ./emsdk/emsdk_env.sh && cd ffmpeg && ./build-ffmpeg.sh
if: steps.cache-ffmpeg.outputs.cache-hit != 'true'
- run: mkdir -p ffmpeg/src
# build application
- name: Install dependencies
run: yarn install
- name: Build WASM
run: source ./emsdk/emsdk_env.sh && mkdir -p wasm/build && cd wasm/build && emcmake cmake .. && emmake make -j
- name: Build parcel
run: NODE_ENV=production yarn parcel build ./src/index.html
- run: echo `git rev-parse HEAD` > dist/COMMIT
- name: Upload Build Result
uses: actions/upload-artifact@v1
with:
name: dist
path: dist
deploy:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Download Build Result
uses: actions/download-artifact@v1
with:
name: dist
# upload to dist branch
- uses: actions/checkout@v2
with:
ref: dist
path: ./dist-branch
- run: rm -rf ./dist-branch/* && cp -r ./dist/* ./dist-branch/
- run: |
COMMIT=`cat dist/COMMIT`
cd dist-branch
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add -A .
git commit --allow-empty -m "update with $COMMIT"
git push