Skip to content

fixing exporting of environment variables #557

fixing exporting of environment variables

fixing exporting of environment variables #557

# 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 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"
# Install Rust
- name: Install Rust
run: ${{ github.workspace }}/.build-scripts/install/rust-wasm.sh
# Install Git Pre-Commit Hooks to Enforce Hooks
- name: Install Git Pre-Commit Hooks to Enforce Hooks
run: ${{ github.workspace }}/.build-scripts/install/pre-commit.sh
# Check Files with Pre-Commit Hooks
- name: Check Files with Pre-Commit Hooks
run: ${{ github.workspace }}/.build-scripts/check/pre-commit.sh
# 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