-
Notifications
You must be signed in to change notification settings - Fork 14
78 lines (74 loc) · 2.67 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
name: Emscripten build
on: [push, pull_request]
jobs:
emscripten_build:
name: Emscripten build
runs-on: ubuntu-latest
concurrency:
group: emscripten-build
steps:
- uses: actions/checkout@v4
- name: Install Emscripten
run: |
sudo apt update
sudo apt -q install emscripten pandoc
- name: Find Git version
id: version
run: |
if git describe --exact-match --tags >/dev/null; then
VERSION=$(git describe --exact-match --tags)
VERSION=${VERSION/#sdl-sopwith-/}
else
VERSION=git-$(git rev-parse --short HEAD)
fi
echo "VERSION=$VERSION-js" >> $GITHUB_OUTPUT
# Patch the version in configure.ac:
sed -i "s/\(AC_INIT([^,]*, \)\[[^]]*\], /\1[$VERSION], /" \
configure.ac
- name: build
run: ./embuild.sh
- name: make pkg
run: |
make -C pkg/emscripten
- name: Upload build
uses: actions/upload-artifact@v4
with:
path: "pkg/emscripten/page"
name: sdl-sopwith-${{steps.version.outputs.VERSION}}
- name: Identify deploy folder
id: deploy_folder
run: |
case ${{ github.ref }} in
refs/heads/*)
echo "${{github.ref}}" | \
sed "s/refs.heads./DEPLOY_FOLDER=branch\//; s/.merge//"
;;
refs/pull/*/merge)
sed "s/refs.pull./DEPLOY_FOLDER=prs\//; s/.merge//"
pr=$(echo "${{github.ref}}" | sed "s/refs.pull.//; s/.merge//")
echo "DEPLOY_FOLDER=/prs/$pr"
echo "PR_NUMBER=$pr"
;;
refs/tags/*)
echo "${{github.ref}}" | sed "s/refs.tags./DEPLOY_FOLDER=tags\//"
;;
*)
;;
esac | tee "$GITHUB_OUTPUT"
- name: Deploy
if: ${{steps.deploy_folder.outputs.DEPLOY_FOLDER != ''}}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: "pkg/emscripten/page"
repository-name: "fragglet/sdl-sopwith-builds"
token: "${{secrets.SDL_SOPWITH_LATEST_SECRET}}"
target-folder: "${{steps.deploy_folder.outputs.DEPLOY_FOLDER}}"
clean: true
commit-message: "Build from fragglet/sdl-sopwith@${{github.sha}} (Version ${{steps.version.outputs.VERSION}})"
- name: Comment PR
if: ${{ github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
Thanks for your pull request! A build of your change can be found [here](https://fragglet.github.io/sdl-sopwith-builds${{steps.deploy_folder.outputs.DEPLOY_FOLDER}}/sopwith.html) for people to try.
pr_number: ${{steps.deploy_folder.outputs.PR_NUMBER}}