Skip to content

cge-snapshot-changed #47

cge-snapshot-changed

cge-snapshot-changed #47

# ----------------------------------------------------------------------------
# GitHub Actions workflow that updates Docker image of Castle Game Engine
# with latest unstable (snapshot) CGE version.
# That is, Docker image kambi/castle-engine-cloud-builds-tools:cge-unstable,
# which is
# - cge-unstable tag
# - of https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ .
#
# See https://castle-engine.io/docker for more about this Docker image.
# ----------------------------------------------------------------------------
name: Update CGE Docker Image cge-unstable
on:
push:
pull_request:
repository_dispatch:
types: [cge-snapshot-changed]
defaults:
run:
shell: bash
jobs:
build:
name: Build
# Since we upload Docker images in this job (and the Docker images are
# not tagged with GitHub branch) we should not run this on every branch.
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
steps:
- name: Castle Game Engine GIT SHA that caused this action
run: echo "${{ github.event.client_payload.cge_commit_sha }}"
- uses: actions/checkout@v4
- name: Update Docker image
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_GITHUB_USER: ${{ secrets.DOCKER_GITHUB_USER }}
DOCKER_GITHUB_TOKEN: ${{ secrets.DOCKER_GITHUB_TOKEN }}
run: ./build-cge-unstable.sh
# On self-hosted machine, we would do additionally
# ./remove_unused_docker_images.sh
# Seems not necessary on GH-hosted machine, as they are cleaned each time.
after_build:
name: After Build
needs: build
uses: ./.github/workflows/after-build.yml
# Pass secrets to the after-build.yml, otherwise they are not available there.
# See https://docs.github.com/en/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow
secrets:
GH_TOKEN_DISPATCH_AFTER_UPDATE: ${{ secrets.GH_TOKEN_DISPATCH_AFTER_UPDATE }}