Merge pull request #939 from AMS21/dependabot/submodules/external/ben… #1176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
release: | |
types: [published] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
CMAKE_C_COMPILER_LAUNCHER: "ccache" | |
CMAKE_CXX_COMPILER_LAUNCHER: "ccache" | |
jobs: | |
gh_pages: | |
runs-on: ubuntu-24.04 | |
if: github.event_name != 'release' | |
env: | |
EM_CACHE_FOLDER: 'emsdk-cache' | |
EM_VERSION: "3.1.70" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
submodules: recursive | |
- name: Setup Emscripten | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
version: ${{ env.EM_VERSION }} | |
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }} | |
- name: Setup ccache | |
uses: hendrikmuhs/ccache-action@v1 | |
with: | |
key: ${{ runner.os }}-emscripten-${{ env.EM_VERSION }} | |
- name: Verify version | |
run: emcc --version | |
- name: Setup Environment | |
run: external/Phi/scripts/ci/SetupEnvironment.sh | |
- name: Install ninja | |
run: external/Phi/scripts/ci/InstallTools.sh ninja | |
- name: Install dependencies | |
run: sudo scripts/ci/InstallDependencies.sh | |
- name: Install minifiers | |
run: | | |
sudo npm install html-minifier -g | |
sudo npm install uglify-js -g | |
- name: Build main | |
run: | | |
mkdir -p build | |
cd build | |
emcmake cmake .. -DCMAKE_BUILD_TYPE=Release | |
emmake cmake --build . --clean-first --target DLXEmu | |
# Move minified html | |
# See option reference here: https://github.com/kangax/html-minifier#options-quick-reference | |
html-minifier ../data/index.html --collapse-boolean-attributes --collapse-inline-tag-whitespace --collapse-whitespace --decode-entities --minify-css true --minify-js true --minify-urls true --remove-attribute-quotes --remove-comments --remove-empty-attributes --remove-optional-tags --remove-redundant-attributes --remove-script-type-attributes --remove-style-link-type-attributes --sort-attributes --sort-class-name --use-short-doctype > bin/index.html | |
# Minify all .js files | |
find bin -maxdepth 1 -type f -iname "*.js" -exec bash -c 'uglifyjs ${0} --compress drop_console,expression,hoist_funs,hoist_vars,passes=10,toplevel --no-annotations --mangle eval,reserved=['Module'] --mangle-props keep_quoted --source-map --toplevel --module --ie --v8 --webkit --output ${0}' {} \; | |
# Copy to output directory | |
mkdir -p $GITHUB_WORKSPACE/output | |
cp -r bin/* $GITHUB_WORKSPACE/output | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
submodules: recursive | |
path: develop | |
- name: Build develop | |
run: | | |
cd develop | |
mkdir -p build | |
cd build | |
emcmake cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS="-DDLXEMU_VERIFY_UNDO_REDO -DDLXEMU_VERIFY_COLUMN -DPHI_DEBUG" | |
emmake cmake --build . --clean-first --target DLXEmu | |
cp ../data/index.html bin/index.html | |
# Copy to output directory | |
mkdir -p $GITHUB_WORKSPACE/output/staging | |
cp -r bin/* $GITHUB_WORKSPACE/output/staging | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.BOT_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BOT_KEY_PASSPHRASE }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: Deploy | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: output | |
git-config-name: AMS21Bot | |
git-config-email: AMS21Bot.github@gmail.com |