Skip to content

Commit

Permalink
Update other repos when Docker rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
michaliskambi committed Jun 25, 2024
1 parent 871ab5c commit cf0ee49
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/after-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ----------------------------------------------------------------------------
# GitHub Actions workflow that causes rebuild of all CGE repos
# that rely on CGE Docker images.
# This allows to test that the new CGE (Docker, GitHub code) is compatible
# with all CGE projects.
# ----------------------------------------------------------------------------

name: After Build

# Called by other xxx.yml
on: [workflow_call]

defaults:
run:
shell: bash

jobs:
dispatch-rebuild:
name: Dispatch Rebuild To Other Repos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# Make https://github.com/castle-engine/castle-engine-docker
# rebuild Docker image with the latest CGE snapshot.
#
# See repository_dispatch docs:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch
# https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#create-a-repository-dispatch-event
- name: Dispatch updating Docker cge-unstable
env:
GH_TOKEN: ${{ secrets.GH_TOKEN_DISPATCH_AFTER_UPDATE }}
run: |
gh api --method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/castle-engine/castle-model-viewer/dispatches \
-f "event_type=cge-docker-unstable-changed" \
-F "client_payload[cge_docker_commit_sha]=${{ github.sha }}"
gh api --method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/castle-engine/castle-model-viewer-mobile/dispatches \
-f "event_type=cge-docker-unstable-changed" \
-F "client_payload[cge_docker_commit_sha]=${{ github.sha }}"
gh api --method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/castle-engine/cge-www/dispatches \
-f "event_type=cge-docker-unstable-changed" \
-F "client_payload[cge_docker_commit_sha]=${{ github.sha }}"
5 changes: 5 additions & 0 deletions .github/workflows/update-docker-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,8 @@ jobs:
IFS=$'\n\t'
source build-common.sh
do_everything_for_image_unstable
after_build:
name: After Build
needs: [build-none, build-stable, build-unstable]
uses: ./.github/workflows/after-build.yml
5 changes: 5 additions & 0 deletions .github/workflows/update-docker-cge-unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,8 @@ jobs:
# 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

0 comments on commit cf0ee49

Please sign in to comment.