rewrote entire commit history and added initialization script #543
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
# Sample workflow for building and deploying a Jekyll site to GitHub Pages | |
name: Deploy Github Pages Site | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
runanyway: | |
description: 'Override --norun Flag' | |
required: true | |
default: 'no' | |
type: choice | |
options: | |
- 'no' | |
- 'yes' | |
# 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: | |
# Build job | |
build: | |
if: (!endsWith(github.event.head_commit.message, '--norun') || inputs.runanyway == 'yes') | |
runs-on: ubuntu-latest | |
env: | |
PKG_URL: https://engine.catgirl.land/pkg | |
steps: | |
# Setup Build Environment | |
- name: 🎉 The job was automatically triggered by a ${{ github.event_name }} event. | |
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." | |
- name: 🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub! | |
run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" | |
- name: 🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}. | |
run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
submodules: recursive | |
- name: 💡 The ${{ github.repository }} repository has been cloned to the runner. | |
run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
# Install Rust | |
- name: Make Tools Directory | |
run: mkdir -p ${{ github.workspace }}/tools | |
- name: Download Rust Installer | |
run: curl --proto '=https' --tlsv1.2 --silent --show-error --fail --location https://sh.rustup.rs > ${{ github.workspace }}/tools/rust.sh | |
- name: Make Rust Installer Executable | |
run: chmod +x ${{ github.workspace }}/tools/rust.sh | |
- name: Install Rust | |
run: ${{ github.workspace }}/tools/rust.sh -y | |
- name: Load Cargo Environment | |
run: source "$HOME/.cargo/env" | |
# Install Rust Stable Toolchains | |
- name: Set Rust To The Stable Toolchains | |
run: $HOME/.cargo/bin/rustup default stable | |
# Install Ruby | |
- name: Setup Ruby Action (For Installing and Caching Gems) | |
uses: ruby/setup-ruby@v1 | |
with: | |
cache-version: "gh-pages-ruby-gems" | |
working-directory: ${{ github.workspace }}/docs | |
bundler-cache: true | |
# Setup Pages | |
- name: Setup Pages | |
id: pages | |
uses: actions/configure-pages@v5 | |
# Setup Rust Build Caching | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "wasm32-pages-rust" | |
# Add Build Targets | |
- name: Add x86_64 GNU Build Target | |
run: $HOME/.cargo/bin/rustup target add wasm32-unknown-unknown | |
# Install Wasm-Bindgen-CLI | |
- name: Install Wasm-Bindgen-CLI | |
run: | | |
# wasm-bindgen is currently unstable, so getting the exact version used is required | |
export WASM_BINDGEN_VERSION=`cat ${{ github.workspace }}/Cargo.toml | grep '^wasm-bindgen' | head -n1 | cut -d'"' -f2 | tr -d '\n'` | |
$HOME/.cargo/bin/cargo install wasm-bindgen-cli --version $WASM_BINDGEN_VERSION | |
# Install Wasm-Opt | |
- name: Install Wasm-Opt | |
run: $HOME/.cargo/bin/cargo install wasm-opt | |
# Install Wasm2Map | |
- name: Install Wasm2Map | |
run: $HOME/.cargo/bin/cargo install cargo-wasm2map | |
# Compile Program | |
- name: Build Engine (Release) | |
run: | | |
# Sets the build timestamp to the current commit to make builds reproducible | |
export SOURCE_DATE_EPOCH="`git --no-pager log -1 --format="%at"`" | |
$HOME/.cargo/bin/cargo build --target wasm32-unknown-unknown --verbose --release --lib | |
# Generate Bindings | |
- name: Generate Bindings | |
run: | | |
# When building for debug, add --keep-debug to wasm-bindgen to keep the DWARF debug info for the source map generator (may cause wasm-opt to segfault) | |
# --debug adds extra checks in the javascript portion for debugging the wasm | |
$HOME/.cargo/bin/wasm-bindgen ${{ github.workspace }}/target/wasm32-unknown-unknown/release/main.wasm --out-dir ${{ github.workspace }}/docs/pkg --typescript --target web | |
# Optimize Program | |
- name: Optimize Program | |
run: | | |
$HOME/.cargo/bin/wasm-opt ${{ github.workspace }}/docs/pkg/main_bg.wasm -o ${{ github.workspace }}/docs/pkg/main_bg.opt.wasm -Oz | |
mv ${{ github.workspace }}/docs/pkg/main_bg.opt.wasm ${{ github.workspace }}/docs/pkg/main_bg.wasm | |
# Build Source Maps | |
# - name: Build Source Maps | |
# run: | | |
# $HOME/.cargo/bin/cargo wasm2map ${{ github.workspace }}/docs/pkg/main_bg.wasm --patch --base-url $PKG_URL | |
# Display Export Directory | |
- name: Display Git Staging | |
run: | | |
cd ${{ github.workspace }} | |
git status -v -s -b | |
# Build Docs | |
- name: Build Docs | |
run: $HOME/.cargo/bin/cargo doc --target=wasm32-unknown-unknown --release --lib --workspace | |
# Copy Assets | |
- name: Copy Assets | |
run: | | |
mkdir -p ${{ github.workspace }}/docs/resources | |
# cp -af ${{ github.workspace }}/resources/wasm ${{ github.workspace }}/docs/resources | |
cp -af ${{ github.workspace }}/resources/assets ${{ github.workspace }}/docs/resources | |
# Copy Docs | |
- name: Copy Docs | |
run: cp -af ${{ github.workspace }}/target/wasm32-unknown-unknown/doc ${{ github.workspace }}/docs/docs | |
# Copy Manifest | |
- name: Copy Manifest | |
run: cp -af ${{ github.workspace }}/examples/wasm/web/manifest.json ${{ github.workspace }}/docs | |
# Generate Service Worker | |
- name: Generate Service Worker | |
run: sed "s/%CACHE_VERSION%/`/usr/bin/git rev-parse HEAD`/" ${{ github.workspace }}/examples/wasm/web/service-worker.js.template > ${{ github.workspace }}/docs/service-worker.js | |
# Build with Jekyll | |
- name: Build with Jekyll | |
env: | |
JEKYLL_ENV: production | |
JEKYLL_GITHUB_TOKEN: ${{ github.token }} | |
PAGES_REPO_NWO: ${{ github.repository }} | |
run: | | |
cd ${{ github.workspace }}/docs | |
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" --source ${{ github.workspace }}/docs --destination ${{ github.workspace }}/_site | |
# Upload artifact | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
# List Environment | |
- name: List Environment | |
run: env | |
- name: List All Installed Packages | |
run: | | |
apt list --installed | wc -l | |
apt list --installed | |
- name: List All Files | |
run: find ${{ github.workspace }} | |
# Display Build Status | |
- name: 🍏 This job's status is ${{ job.status }}. | |
run: echo "🍏 This job's status is ${{ job.status }}." | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# Deploy to Github Pages | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |