From 6e73d3808449e11aad389242682cce195937057c Mon Sep 17 00:00:00 2001 From: David Gagnon Date: Wed, 23 Sep 2026 22:42:11 -0500 Subject: [PATCH 1/2] Also publish WebGL builds to the Vault staging CDN (alongside DoIT) Adds a preview job that publishes the same build artifact to https://cdn.vaultlearninggames-staging.org/fielddaylab/ais-prototype// via fielddaylab/vault-publisher, and removes a branch's preview when the branch is deleted. The Unity build and DoIT deploy are unchanged. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build-webgl.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-webgl.yml b/.github/workflows/build-webgl.yml index 41a36b5c..1fcf79d6 100644 --- a/.github/workflows/build-webgl.yml +++ b/.github/workflows/build-webgl.yml @@ -5,11 +5,13 @@ name: AIS Prototype Build # way of doing this. on: push: + delete: workflow_dispatch: jobs: build: name: Build Unity Project + if: github.event_name != 'delete' runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -88,7 +90,7 @@ jobs: - name: Upload build as artifact uses: actions/upload-artifact@v4 with: - name: ${{ github.event.repository.name }}-webgl_${{ env.VERSION }} + name: ${{ github.event.repository.name }}-webgl-${{ github.sha }} path: build/WebGL/WebGL/ overwrite: true @@ -101,4 +103,27 @@ jobs: remote_host: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_HOST }} remote_user: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_USER }} remote_key: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_KEY }} - \ No newline at end of file + + # Vault staging CDN preview of the same build, alongside the DoIT deploy above until DoIT is retired: + # https://cdn.vaultlearninggames-staging.org/fielddaylab/ais-prototype// + # Runs even if the DoIT upload fails; needs only the build artifact. + preview: + needs: build + if: ${{ !cancelled() && github.event_name != 'delete' }} + permissions: + contents: read + id-token: write + uses: fielddaylab/vault-publisher/.github/workflows/publish-preview.yml@v1 + with: + game: ais-prototype + artifact: ${{ github.event.repository.name }}-webgl-${{ github.sha }} + + # Deleting a branch removes its preview. + remove-preview: + if: github.event_name == 'delete' + permissions: + contents: read + id-token: write + uses: fielddaylab/vault-publisher/.github/workflows/publish-preview.yml@v1 + with: + game: ais-prototype From 3bd8c7cda98c326a8e82f5748000355792d581fe Mon Sep 17 00:00:00 2001 From: David Gagnon Date: Wed, 23 Sep 2026 23:44:00 -0500 Subject: [PATCH 2/2] Separate the Unity build, DoIT deploy and Vault CDN preview into independent jobs build (fielddaylab/vault-publisher unity-build.yml@v1) uploads one artifact; 'doit' (legacy VPN + rsync) and 'preview' (Vault staging CDN) each deploy it and don't depend on each other. The VPN now connects right before the rsync instead of before the 45-minute build. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/build-webgl.yml | 147 +++++++++--------------------- 1 file changed, 45 insertions(+), 102 deletions(-) diff --git a/.github/workflows/build-webgl.yml b/.github/workflows/build-webgl.yml index 1fcf79d6..57d95635 100644 --- a/.github/workflows/build-webgl.yml +++ b/.github/workflows/build-webgl.yml @@ -1,124 +1,30 @@ name: AIS Prototype Build -# Controls when the action will run. Triggers the workflow on creation of -# tags. Creating new 'versions' via github is the most straightforward -# way of doing this. +# One Unity build, deployed independently to: +# - the Vault staging CDN: https://cdn.vaultlearninggames-staging.org/fielddaylab/ais-prototype// +# - the DoIT server (legacy; delete the `doit` job when DoIT is retired) +# The two deploys don't depend on each other. Deleting a branch removes its CDN preview. on: push: delete: workflow_dispatch: - + jobs: build: - name: Build Unity Project if: github.event_name != 'delete' - runs-on: ubuntu-latest - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - - # Setup Steps - - steps: - - - name: Free disk space - run: curl -fsSL https://raw.githubusercontent.com/kou/arrow/e49d8ae15583ceff03237571569099a6ad62be32/ci/scripts/util_free_space.sh | bash - - - name: Install OpenConnect - run: sudo NEEDRESTART_MODE=a sudo apt-get update && sudo apt-get install openconnect - - - name: Connect to VPN - run: echo ${{ secrets.FIELDDAY_VPN_PASSWORD }} | sudo openconnect --protocol=gp -u ${{ secrets.FIELDDAY_VPN_USERNAME }} --passwd-on-stdin soe.vpn.wisc.edu & - - - name: Checkout repository - uses: actions/checkout@v4 - with: - lfs: true - - - name: Checkout submodules - uses: srt32/git-actions@v0.0.3 - with: - args: | - git config --global --add safe.directory "/github/workspace" - git config --global --add safe.directory "/github/workspace/Submodules" - git submodule update --init --recursive - - # Extracts branch name into BRANCH environment variable - - name: Extract branch name - shell: bash - run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_ENV - - # Extracts version tag into VERSION environment variable - - name: Extract version name - shell: bash - run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/} | sed 's/\//_/g')" >> $GITHUB_ENV + uses: fielddaylab/vault-publisher/.github/workflows/unity-build.yml@v1 + secrets: inherit - # Read editor version - - name: Retrieve editor version - id: getEditorVersion - uses: pietrobolcato/action-read-yaml@1.1.0 - with: - config: ${{ github.workspace }}/ProjectSettings/ProjectVersion.txt - - - name: Extract editor version to var - shell: bash - run: echo "UNITY_VERSION=${{ steps.getEditorVersion.outputs['m_EditorVersion'] }}" >> $GITHUB_ENV - - # Unity Build Steps - - - name: Cache Library folder - uses: actions/cache@v3 - with: - path: Library - key: Library - - # Build - - name: Build project - uses: game-ci/unity-builder@v4 - env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - with: - unityVersion: ${{ env.UNITY_VERSION }} - targetPlatform: WebGL - #customParameters: '-myParameter myValue -myBoolean -ThirdParameter andItsValue' - - - # Deploy Steps - - - name: Upload build as artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ github.event.repository.name }}-webgl-${{ github.sha }} - path: build/WebGL/WebGL/ - overwrite: true - - - name: Upload to web server via rsync - uses: burnett01/rsync-deployments@5.2 - with: - switches: -avzr --delete --rsync-path="mkdir -p ${{ secrets.DEPLOY_DIR }}/${{ env.BRANCH }} && rsync" - path: build/WebGL/WebGL/* - remote_path: ${{ secrets.DEPLOY_DIR }}/${{ env.BRANCH }} - remote_host: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_HOST }} - remote_user: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_USER }} - remote_key: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_KEY }} - - # Vault staging CDN preview of the same build, alongside the DoIT deploy above until DoIT is retired: - # https://cdn.vaultlearninggames-staging.org/fielddaylab/ais-prototype// - # Runs even if the DoIT upload fails; needs only the build artifact. preview: needs: build - if: ${{ !cancelled() && github.event_name != 'delete' }} permissions: contents: read id-token: write uses: fielddaylab/vault-publisher/.github/workflows/publish-preview.yml@v1 with: game: ais-prototype - artifact: ${{ github.event.repository.name }}-webgl-${{ github.sha }} + artifact: ${{ needs.build.outputs.artifact }} - # Deleting a branch removes its preview. remove-preview: if: github.event_name == 'delete' permissions: @@ -127,3 +33,40 @@ jobs: uses: fielddaylab/vault-publisher/.github/workflows/publish-preview.yml@v1 with: game: ais-prototype + + # Legacy DoIT deploy: https://fielddaylab.wisc.edu/play/ais-prototype/ci// + doit: + needs: build + runs-on: ubuntu-latest + concurrency: + group: doit-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + steps: + - name: Download build + uses: actions/download-artifact@v8 + with: + name: ${{ needs.build.outputs.artifact }} + path: build + + - name: Install OpenConnect + run: sudo NEEDRESTART_MODE=a apt-get -q update && sudo NEEDRESTART_MODE=a apt-get -q install -y openconnect + + - name: Connect to VPN + run: | + echo "${{ secrets.FIELDDAY_VPN_PASSWORD }}" | sudo openconnect --protocol=gp -u "${{ secrets.FIELDDAY_VPN_USERNAME }}" --passwd-on-stdin --background soe.vpn.wisc.edu + # Wait for the tunnel before uploading. + for _ in $(seq 1 30); do ip link show tun0 > /dev/null 2>&1 && exit 0; sleep 2; done + echo "::error::VPN tunnel did not come up"; exit 1 + + - name: Branch folder name + run: echo "BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/\//_/g')" >> "$GITHUB_ENV" + + - name: Upload to web server via rsync + uses: burnett01/rsync-deployments@5.2 + with: + switches: -avzr --delete --rsync-path="mkdir -p ${{ secrets.DEPLOY_DIR }}/${{ env.BRANCH }} && rsync" + path: build/* + remote_path: ${{ secrets.DEPLOY_DIR }}/${{ env.BRANCH }} + remote_host: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_HOST }} + remote_user: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_USER }} + remote_key: ${{ secrets.FIELDDAY_WISC_EDU_DEPLOY_KEY }}