101 lines
3.2 KiB
YAML
101 lines
3.2 KiB
YAML
name: muon-iframe-build-publish
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
muon_git_ref:
|
|
description: "Upstream Muon ref (branch/tag/commit) used as Docker build arg"
|
|
required: true
|
|
default: "main"
|
|
stemengine_allowed_origin:
|
|
description: "Comma-separated frontend origin allowlist for Muon postMessage"
|
|
required: true
|
|
default: "http://localhost:5174,http://localhost:3001"
|
|
push_image:
|
|
description: "Push image to GHCR"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
push:
|
|
tags:
|
|
- "muon-iframe-v*"
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/stemengine-muon
|
|
MUON_GIT_REF: ${{ inputs.muon_git_ref || 'main' }}
|
|
STEMENGINE_ALLOWED_ORIGIN: ${{ inputs.stemengine_allowed_origin || 'http://localhost:5174,http://localhost:3001' }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
if: ${{ inputs.push_image != false || startsWith(github.ref, 'refs/tags/muon-iframe-v') }}
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=raw,value=${{ env.MUON_GIT_REF }}
|
|
type=sha
|
|
type=ref,event=tag
|
|
|
|
- name: Build and optionally push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: ./muon-iframe
|
|
file: ./muon-iframe/Dockerfile
|
|
push: ${{ inputs.push_image != false || startsWith(github.ref, 'refs/tags/muon-iframe-v') }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
build-args: |
|
|
MUON_GIT_REF=${{ env.MUON_GIT_REF }}
|
|
STEMENGINE_ALLOWED_ORIGIN=${{ env.STEMENGINE_ALLOWED_ORIGIN }}
|
|
|
|
- name: Placeholder substitution gate
|
|
run: |
|
|
set -euo pipefail
|
|
docker build \
|
|
--build-arg MUON_GIT_REF="${MUON_GIT_REF}" \
|
|
--build-arg STEMENGINE_ALLOWED_ORIGIN="${STEMENGINE_ALLOWED_ORIGIN}" \
|
|
-t stemengine-muon-ci-verify \
|
|
./muon-iframe
|
|
|
|
if docker run --rm stemengine-muon-ci-verify sh -lc "grep -R -n '__STEMENGINE_ALLOWED_ORIGIN__' /usr/share/nginx/html"; then
|
|
echo "PLACEHOLDER NOT SUBSTITUTED"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Summary
|
|
run: |
|
|
{
|
|
echo "## Muon iframe build"
|
|
echo ""
|
|
echo "- Image: \\`${IMAGE_NAME}\\`"
|
|
echo "- MUON_GIT_REF: \\`${MUON_GIT_REF}\\`"
|
|
echo "- STEMENGINE_ALLOWED_ORIGIN: \\`${STEMENGINE_ALLOWED_ORIGIN}\\`"
|
|
echo "- Trigger: \\`${GITHUB_EVENT_NAME}\\`"
|
|
echo "- Ref: \\`${GITHUB_REF}\\`"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|