Skip to content

Commit

Permalink
almost there!
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyPenguins committed Mar 10, 2025
1 parent 1717642 commit dc234ab
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 20 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

pull_request_target: # use trusted workflow (as opposed to `pull_request`)
types:
- labeled # workaround for manual triggering...if we actually start using labels this might need to be removed
- opened
- reopened
- synchronize
Expand Down Expand Up @@ -53,7 +54,7 @@ jobs:
- name: Build static site
working-directory: ./
run: |
bash ./splashkitonline/.github/workflows/build_static_site.sh "${{ github.sha }}" "${{ github.event_name }}"
bash ./splashkitonline/.github/workflows/build_static_site.sh "${{ github.sha }}" "${{ github.event_name }}" "${{ github.repository }}"
env:
GITHUB_TOKEN: ''

Expand Down Expand Up @@ -127,15 +128,15 @@ jobs:
zip -r "../splashkitonline-static-site-$file_name.zip" ./ # note: this name is expected in download_github_site_previews.py
echo "../splashkitonline-static-site-$file_name.zip" >> ../../script/.github/workflows/release_assets.txt
python3 ../../script/.github/workflows/release.py "update" "${{ secrets.GITHUB_TOKEN }}" "WhyPenguins/SplashkitOnline" "$tag_name" "${{ github.sha }}" yes "../../script/.github/workflows/release_assets.txt" "# Static Site Build ($tag_name)\nA static build of $tag_name, used in the live deployment :smiley:"
python3 ../../script/.github/workflows/release.py "update" "${{ secrets.GITHUB_TOKEN }}" "${{ github.repository }}" "$tag_name" "${{ github.sha }}" yes "../../script/.github/workflows/release_assets.txt" "# Static Site Build ($tag_name)\nA static build of $tag_name, used in the live deployment :smiley:"
- name: Or delete the release...
if: ${{ github.event_name == 'pull_request_target' && github.event.action == 'closed' }}
working-directory: ./repo/built-site
run: |
echo " PR Release Delete! ${{ github.ref_name }}"
if [ github.event.action == "closed" ]; then
python3 ../../script/.github/workflows/release.py "delete" "${{ secrets.GITHUB_TOKEN }}" "WhyPenguins/SplashkitOnline" "pr/${{ github.event.number }}"
python3 ../../script/.github/workflows/release.py "delete" "${{ secrets.GITHUB_TOKEN }}" "${{ github.repository }}" "pr/${{ github.event.number }}"
fi
# The following bits assume the GitHub Pages site is about to be updated with this new release preview
Expand Down
52 changes: 36 additions & 16 deletions .github/workflows/build_static_site.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
set -e
#build_static_site.sh <sha> <workflow event_name> <username/repo>

# Do we need to build?
cd ./splashkitonline
# only build if the SplashKitWasm folder has changed, or if this was a push to a branch (so branches always build)
if ! git diff --quiet $(git merge-base main "$1").."$1" -- SplashKitWasm &>/dev/null || [ "$2" == "push" ]; then
cd ../

Expand Down Expand Up @@ -39,7 +41,8 @@ if ! git diff --quiet $(git merge-base main "$1").."$1" -- SplashKitWasm &>/dev/
source ./emsdk_env.sh
cd ../
mkdir -p ./splashkitonline/SplashKitWasm/prebuilt/cxx/compiler/
wget -O ./splashkitonline/SplashKitWasm/prebuilt/cxx/compiler/sysroot.zip https://github.com/WhyPenguins/SplashkitOnline/tree/cxx_language_backend_binaries/SplashKitWasm/prebuilt/sysroot.zip
# build this as well...
wget -O ./splashkitonline/SplashKitWasm/prebuilt/cxx/compiler/sysroot.zip https://github.com/WhyPenguins/SplashkitOnline/raw/refs/heads/cxx_language_backend_binaries/SplashKitWasm/prebuilt/sysroot.zip


cd ./splashkitonline/SplashKitWasm/cmake/
Expand All @@ -51,21 +54,37 @@ if ! git diff --quiet $(git merge-base main "$1").."$1" -- SplashKitWasm &>/dev/

else
cd ../

cd ./splashkitonline/Browser_IDE

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

cd ../../

# rather than building, we'll just grab the compiled binaries from the main release
# to do this, we'll copy over all completely untracked files from it, which will correctly
# handle if the PR has deleted files since branching from main
# Perhaps there's a cleaner way :)

# first let's get a list of files _not_ to copy
cd ./splashkitonline
TRACKED_FILES=$(git log --pretty=format: --name-only --diff-filter=A -- Browser_IDE| sort - | sed '/^$/d')
EXCLUDE_FILE=$(mktemp)
echo "$TRACKED_FILES" | sed "s|^Browser_IDE||" > "$EXCLUDE_FILE"

# add some explicit excludes
echo "/codemirror-5.65.15" >> "$EXCLUDE_FILE"
echo "/jszip" >> "$EXCLUDE_FILE"
echo "/babel" >> "$EXCLUDE_FILE"
echo "/split.js" >> "$EXCLUDE_FILE"
echo "/mime" >> "$EXCLUDE_FILE"
echo "/DemoProjects" >> "$EXCLUDE_FILE"

cd ../

mkdir prebuilt
cd prebuilt
wget https://github.com/WhyPenguins/SplashkitOnline/releases/download/branch%2Fmain/splashkitonline-static-site-branch_main.zip
unzip splashkitonline-static-site-branch_main.zip
rm splashkitonline-static-site-branch_main.zip
cd ../

# copy all the untracked files!
rsync -av --progress --exclude-from="$EXCLUDE_FILE" "prebuilt/" "splashkitonline/Browser_IDE/"

fi

Expand All @@ -86,6 +105,7 @@ echo "Re-Structure Static Site"
echo "========================================"
cd ./splashkitonline/Browser_IDE

# if changed, remember to update the explicit excludes above
mv node_modules/codemirror codemirror-5.65.15
mv node_modules/jszip/dist jszip
mv node_modules/@babel/standalone babel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_github_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
working-directory: ./
run: |
sudo apt-get install tree
python3 ./script/.github/workflows/download_github_site_previews.py "WhyPenguins/SplashkitOnline" static-site
python3 ./script/.github/workflows/download_github_site_previews.py "${{ github.repository }}" static-site
tree
cd static-site
Expand Down

0 comments on commit dc234ab

Please sign in to comment.