forked from thoth-tech/SplashkitOnline
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (128 loc) · 5.95 KB
/
static.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
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["deployed"]
pull_request:
types:
- opened
- reopened
- synchronize
- closed
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
pull-requests: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: static-site
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
env:
GITHUB_TOKEN: ''
- name: Checkout
uses: actions/checkout@v4
with:
path: splashkitonline
submodules: 'true'
env:
GITHUB_TOKEN: ''
- name: npm install
working-directory: ./splashkitonline/Browser_IDE
run: |
npm install
env:
GITHUB_TOKEN: ''
- name: shuffle folders
working-directory: ./splashkitonline/Browser_IDE
run: |
mv node_modules/codemirror codemirror-5.65.15
mv node_modules/jszip/dist jszip
mv node_modules/@babel/standalone babel
mv node_modules/split.js/dist split.js
mv node_modules/mime/dist mime
mv ../DemoProjects DemoProjects
env:
GITHUB_TOKEN: ''
- name: download binaries
working-directory: ./splashkitonline/Browser_IDE #python3 ./setup.py
run: |
wget -O splashkit/splashkit_autocomplete.json https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/splashkit/splashkit_autocomplete.json
wget -O runtimes/javascript/bin/SplashKitBackendWASM.js https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/runtimes/javascript/bin/SplashKitBackendWASM.js
wget -O runtimes/javascript/bin/SplashKitBackendWASM.wasm https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/runtimes/javascript/bin/SplashKitBackendWASM.wasm
wget -O compilers/cxx/bin/wasi-sysroot.zip.lzma https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/compilers/cxx/bin/wasi-sysroot.zip.lzma
wget -O compilers/cxx/bin/clang++.js https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/compilers/cxx/bin/clang++.js
wget -O compilers/cxx/bin/clang.wasm.lzma https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/compilers/cxx/bin/clang.wasm.lzma
wget -O compilers/cxx/bin/wasm-ld.js https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/compilers/cxx/bin/wasm-ld.js
wget -O compilers/cxx/bin/lld.wasm.lzma https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/compilers/cxx/bin/lld.wasm.lzma
wget -O runtimes/cxx/bin/SplashKitBackendWASMCPP.js https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/runtimes/cxx/bin/SplashKitBackendWASMCPP.js
wget -O runtimes/cxx/bin/SplashKitBackendWASMCPP.worker.js https://raw.githubusercontent.com/WhyPenguins/SplashkitOnline/github-live/Browser_IDE/runtimes/cxx/bin/SplashKitBackendWASMCPP.worker.js
env:
GITHUB_TOKEN: ''
# At this point any scripts that exist in the filesystem _cannot_ be trusted
# But I think (...?) if we do everything in the workflow from here on,
# it should be safe and be unable to trash the live site. I think anyway...
# - name: Create Build Archive
# run: tar -c --lzma -f deployed.tar.gz ./Browser_IDE # ${{ inputs.pr-number }}
- name: Checkout Site Builds
uses: actions/checkout@v4
with:
path: site-builds
ref: site-builds
- name: Upload Built Archive
working-directory: ./site-builds
env:
action: ${{ github.event.action }}
event: ${{ github.event_name }}
pr: ${{ github.event.number }}
run: |
git checkout --orphan new-site-builds site-builds
# delete everything except for pr-builds and .git, a bit hacky really...
mkdir -p ./pr-builds
mv ./pr-builds ../
mv ./.git ../
rm -r ./*
mv ../.git ./.git
mv ../pr-builds ./pr-builds
# move the new build in!
echo "Event! ${event}"
echo "Action! ${action}"
if [ "${event}" == "push" ]; then
echo "Deploy!"
mv ../splashkitonline/Browser_IDE/* ./
elif [ "${event}" == "pull_request" ]; then
echo "PR! ${pr}"
rm -rf "./pr-builds/${pr}"
mkdir "./pr-builds/${pr}"
mv ../splashkitonline/Browser_IDE/* ./pr-builds/${pr}/
fi
# commit!
git config --global user.email "buildbot@bot.bot"
git config --global user.name "build-bot-bob"
git add --all
git commit -m "Update builds"
git branch -M new-site-builds site-builds
git push origin site-builds --force-with-lease
- name: Leave a link to the PR
if: ${{ github.event_name }} == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-preview
message: "SplashKit Online PR Preview!:---:Preview at https://${{ steps.deployment.outputs.page_url }}/pr-builds/${{ github.event.number }}"