Skip to content

Merge pull request #51 from jcgraciosa/slcn-check #12

Merge pull request #51 from jcgraciosa/slcn-check

Merge pull request #51 from jcgraciosa/slcn-check #12

Workflow file for this run

name: "GHCR: Binder Base Image"
# Builds the Underworld3 binder-ready Docker image and pushes to GHCR
# The image is used by mybinder.org via the uw3-binder-launcher repository
#
# This is separate from docker-image.yml which builds command-line Docker
# images (also on GHCR, different image name).
on:
push:
branches: [main, development]
tags: ['v*'] # Also build on version tags (e.g., v3.0.0)
paths:
# Only rebuild when these files change (Cython/dependencies require rebuild)
# Note: path filters are ignored for tag pushes (GitHub Actions behaviour)
- 'container/Dockerfile.base.optimized'
- 'pixi.toml'
- 'pixi.lock'
- 'src/**/*.pyx'
- 'src/**/*.c'
- 'setup.py'
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force full rebuild (no cache)'
type: boolean
default: false
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract ref name and type
run: |
REF_NAME="${GITHUB_REF##*/}"
echo "REF_NAME=${REF_NAME}" >> $GITHUB_ENV
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
echo "REF_TYPE=tag" >> $GITHUB_ENV
else
echo "REF_TYPE=branch" >> $GITHUB_ENV
fi
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: container/Dockerfile.base.optimized
push: true
platforms: linux/amd64
no-cache: ${{ inputs.force_rebuild || false }}
tags: |
ghcr.io/underworldcode/uw3-base:${{ env.REF_NAME }}-slim
ghcr.io/underworldcode/uw3-base:latest-slim
# Trigger launcher repo to update/create its branch
# For branches: updates existing .binder/Dockerfile
# For tags: creates a new launcher branch with frozen Dockerfile
# Requires LAUNCHER_PAT secret (Personal Access Token with repo scope)
- name: Trigger launcher update
if: success()
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.LAUNCHER_PAT }}
repository: underworldcode/uw3-binder-launcher
event-type: image-updated
client-payload: '{"branch": "${{ env.REF_NAME }}", "ref_type": "${{ env.REF_TYPE }}"}'