featuremapping gameobjects cleanup #3578
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: Actions | |
on: [push] | |
env: | |
BUILD_OUTPUT_FOLDER: 'build/WebGL/WebGL' | |
PRODUCTION_BUILD_ARTEFACT_NAME: 'viewer' | |
DEVELOPMENT_BUILD_ARTEFACT_NAME: 'viewer-development' | |
jobs: | |
build: | |
name: '🗺️ Build Netherlands3D Viewer' | |
# only run this when a commit was pushed to the main branch | |
if: github.ref_name == 'main' | |
permissions: { contents: read } | |
outputs: | |
buildVersion: ${{ steps.buildUnity.outputs.buildVersion }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Free Disk Space' | |
# see: https://github.com/jlumbroso/free-disk-space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
docker-images: true | |
swap-storage: true | |
- name: 'Checkout code from repository' | |
# see: https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
with: { lfs: true } | |
- name: 'Cache Library folder - restore and track' | |
# see: https://github.com/actions/cache | |
uses: actions/cache@v4 | |
with: | |
path: 'Library' | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: 'Build Unity project to WebGL' | |
id: buildUnity # used when building the docker container to get the version number from | |
# See https://game.ci/docs/github/getting-started | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: WebGL | |
unityVersion: auto | |
# A custom specific image can be used (source: https://github.com/game-ci/unity-builder/blob/main/action.yml): | |
# customImage: unityci/editor:ubuntu-2022.3.8f1-webgl-2 | |
- name: 'Upload artifact to build pipeline' | |
# see: https://github.com/actions/upload-artifact | |
uses: actions/upload-artifact@v4 | |
with: { name: '${{ env.PRODUCTION_BUILD_ARTEFACT_NAME }}', path: '${{ env.BUILD_OUTPUT_FOLDER }}' } | |
build-development: | |
name: '🐞 Build Development Netherlands3D Viewer' | |
permissions: { contents: read } | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Free Disk Space' | |
# see: https://github.com/jlumbroso/free-disk-space | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: false | |
docker-images: true | |
swap-storage: true | |
- name: 'Checkout code from repository' | |
# see: https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
with: { lfs: true } | |
- name: 'Cache Library folder - restore and track' | |
# see: https://github.com/actions/cache | |
uses: actions/cache@v4 | |
with: | |
path: 'Library' | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: 'Build Unity project to WebGL' | |
# See https://game.ci/docs/github/getting-started | |
uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: WebGL | |
customParameters: '-Development -AllowDebugging' | |
# A custom specific image can be used (source: https://github.com/game-ci/unity-builder/blob/main/action.yml): | |
# customImage: unityci/editor:ubuntu-2022.3.8f1-webgl-2 | |
unityVersion: auto | |
- name: 'Upload artifact to build pipeline' | |
# see: https://github.com/actions/download-artifact | |
uses: actions/upload-artifact@v4 | |
with: { name: '${{ env.DEVELOPMENT_BUILD_ARTEFACT_NAME }}', path: '${{ env.BUILD_OUTPUT_FOLDER }}' } | |
build-docker-image: | |
name: '🐳 Build and Publish Docker Image' | |
# only run this when a commit was pushed to the main branch | |
if: github.ref_name == 'main' | |
# only run this after the 'build' stage has successfully completed | |
needs: [ 'build' ] | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Checkout repository' | |
# see: https://github.com/actions/checkout | |
uses: actions/checkout@v4 | |
with: { lfs: true } | |
- name: 'Download built viewer' | |
# see: https://github.com/actions/download-artifact | |
uses: actions/download-artifact@v4 | |
with: { name: '${{ env.PRODUCTION_BUILD_ARTEFACT_NAME }}', path: '${{ env.BUILD_OUTPUT_FOLDER }}' } | |
- name: 'Show Version' | |
run: 'echo "Version: ${{ needs.build.outputs.buildVersion }}"' | |
- name: 'Docker: Login to GitHub Container Registry' | |
uses: docker/login-action@v3 | |
with: | |
registry: 'ghcr.io' | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: 'Docker: Build and push image' | |
if: github.ref_name == 'main' # double ensure this is only on main, in case of debugging | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: .docker/Dockerfile | |
push: true | |
build-args: | | |
SOURCE_PATH=${{ env.BUILD_OUTPUT_FOLDER }} | |
tags: | | |
ghcr.io/netherlands3d/twin:${{ needs.build.outputs.buildVersion }} | |
ghcr.io/netherlands3d/twin:latest | |
deploy: | |
name: '🌐 Deploy the viewer to Github Pages' | |
# only run this when a commit was pushed to the main branch | |
if: github.ref_name == 'main' | |
# only run this after the 'build' stage has successfully completed | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: 'github-pages' | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download built viewer' | |
# see: https://github.com/actions/download-artifact | |
uses: actions/download-artifact@v4 | |
with: { name: '${{ env.PRODUCTION_BUILD_ARTEFACT_NAME }}', path: '${{ env.BUILD_OUTPUT_FOLDER }}' } | |
- name: 'Prepare artefact for deployment' | |
if: github.ref_name == 'main' # double ensure this is only on main, in case of debugging | |
# see: https://github.com/actions/upload-pages-artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: '${{ env.BUILD_OUTPUT_FOLDER }}' | |
- name: 'Deploy to GitHub Pages' | |
if: github.ref_name == 'main' # double ensure this is only on main, in case of debugging | |
id: deployment | |
# see: https://github.com/actions/deploy-pages | |
uses: actions/deploy-pages@v4 |