-
Notifications
You must be signed in to change notification settings - Fork 104
103 lines (87 loc) · 2.87 KB
/
emscripten.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
name: Emscripten
on:
push:
branches: [master, ci]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
all_but_latest: true
- name: Checkout Base Repo
uses: actions/checkout@v4
- name: Prepare Submodules
run: |
git submodule sync
git submodule update --init --recursive --force
mv lib lib_
- name: Calculate Hash Key
id: cache_config
run: |
# Invalidate cache if submodules, patches or emscripten version changed
key="$(find build/patches/ -type f | sort | xargs cat .gitmodules Dockerfile \
Makefile Makefile_licence | shasum -a 256 | cut -d' ' -f1)"
echo "key=0-${key}" >> $GITHUB_OUTPUT
- name: Ensure Cache will be newer than Checkout
run: |
find . -exec touch -d 1971-01-01T00:00:00 '{}' +
- name: Retrieve Cached Built Dependencies
uses: actions/cache@v4
id: cache
with:
key: ${{ steps.cache_config.outputs.key }}
path: |
lib
build/lib
dist/libraries
dist/license/*
!dist/license/subtitlesoctopus
!dist/license/all*
/tmp/emcc_lto
- name: Checkout Submodules
if: steps.cache.outputs.cache-hit != 'true'
run: |
mv lib_ lib
- name: Build Docker Image
run: |
docker build -t libass/jso .
- name: Build Binaries
run: |
mkdir -p /tmp/emcc_lto
docker run --rm --env LC_ALL=C.UTF-8 -v "${PWD}":/code -v "/tmp/emcc_lto:/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten/lto" libass/jso:latest
- name: Upload Nightly Build
uses: actions/upload-artifact@v4
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
with:
name: js
path: dist/js
update_gh-pages:
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Remove old assets
run: rm -fr assets/js
- name: Download nightly build
uses: actions/download-artifact@v4
with:
name: js
path: assets/js
- name: Push new version
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add assets/js
(git commit -m "$(printf \
"Update binaries to latest nightly\n\nFrom %s" "${{ github.sha }}")" \
&& git push origin gh-pages) \
|| : # Ignore if nothing changed