Skip to content

Add example

Add example #4

Workflow file for this run

name: Build example
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install Java ♨️
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
- name: Build 🔧
env:
DEFOLD_BOB_SHA1: ${{ secrets.DEFOLD_BOB_SHA1 }}
PLATFORM: js-web
ARCHITECTURES: wasm-web
run: |
lsb_release -a
mkdir -p build/bundle
# Download the latest bob.jar
BOB_SHA1=${DEFOLD_BOB_SHA1:-$(curl -s 'https://d.defold.com/stable/info.json' | jq -r .sha1)}
BOB_LOCAL_SHA1=$((java -jar build/bundle/bob.jar --version | cut -d' ' -f6) || true)
if [ "${BOB_LOCAL_SHA1}" != "${BOB_SHA1}" ]; then wget --progress=dot:mega -O build/bundle/bob.jar "https://d.defold.com/archive/${BOB_SHA1}/bob/bob.jar"; fi
java -jar build/bundle/bob.jar --version
# Build the project
java -jar build/bundle/bob.jar --email a@b.com --auth 123 --texture-compression true --bundle-output build/bundle/${PLATFORM} --platform ${PLATFORM} --architectures ${ARCHITECTURES} --archive --variant debug resolve build bundle
# Move to the public directory
mv build/bundle/${PLATFORM}/* build/bundle/public
# - name: Upload Artifact 📦
# uses: actions/upload-artifact@v4
# with:
# name: bundle
# path: build/bundle/public
- name: Deploy to Pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/bundle/public
if: github.ref == 'refs/heads/main'