Merge pull request #163 from cdsupina/ui-buttons #65
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: Web release -- Netlify | |
on: | |
# We will publish to the dev website on pushes to main, with the option of manually cutting a release to the prod website. | |
workflow_dispatch: | |
inputs: | |
deploymentAppTier: | |
description: 'Application tier of the deployed site. Dev or prod.' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- prod | |
push: | |
branches: | |
- main | |
env: | |
RUST_BACKTRACE: 1 | |
APP_TIER: "${{ ((github.event_name == 'workflow_dispatch') && (inputs.deploymentAppTier == 'prod')) && 'PROD' || 'DEV' }}" | |
jobs: | |
wasm-publish: | |
name: Build and publish WASM-based game to Netlify | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Log App tier | |
id: start | |
run: | | |
set -euxo pipefail | |
echo "Publishing app tier: $APP_TIER" | |
echo "shortGitSha=${GITHUB_SHA:0:7}" >> "$GITHUB_OUTPUT" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install rust nightly toolchain | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
targets: wasm32-unknown-unknown | |
- name: Install bevy deps and binaryen for wasm optimization | |
run: | | |
set -euxo pipefail | |
sudo apt update && sudo apt upgrade && sudo apt install -y lld g++ pkg-config libx11-dev libasound2-dev libudev-dev binaryen | |
- name: Build wasm assets | |
run: ./build_wasm.sh | |
- name: Publish deployment to netlify website | |
id: publish | |
uses: jsmrcaga/action-netlify-deploy@v2.0.0 | |
with: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ (env.APP_TIER == 'PROD') && secrets.NETLIFY_PROD_THETAWAVE_SITE_ID || secrets.NETLIFY_DEV_THETAWAVE_SITE_ID }} | |
NETLIFY_DEPLOY_MESSAGE: > | |
Source: https://github.com/${{github.repository}}/tree/${{ steps.start.outputs.shortGitSha }} | |
Build: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
NETLIFY_DEPLOY_TO_PROD: true # This means we opt out of netlify's 'branch deployments' and manage app tiers via separate site ids | |
install_command: "echo Skipping installing the dependencies" | |
build_command: "echo Skipping building the web files" | |
build_directory: "out/" | |
- name: Finish CI | |
run: | | |
set -euxo pipefail | |
echo 'See the website at ${{ steps.publish.outputs.NETLIFY_LIVE_URL }} .' | |
echo 'Immutable site deployment URL : ${{ steps.publish.outputs.NETLIFY_PREVIEW_URL }} .' | |