Skip to content

Merge remote-tracking branch 'origin/main' #24

Merge remote-tracking branch 'origin/main'

Merge remote-tracking branch 'origin/main' #24

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, 'release/*']
tags: ['v*'] # Build on release tags (v3.0.0, v3.1.0, etc.)
paths:
# Only rebuild when these files change (Cython/dependencies require rebuild)
# Note: path filters are ignored for tag pushes (GitHub always triggers on tags)
- '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: |
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
REF_NAME=${GITHUB_REF#refs/tags/}
IS_RELEASE=true
else
REF_NAME=${GITHUB_REF#refs/heads/}
IS_RELEASE=false
fi
# Docker tags cannot contain slashes — sanitize for image tagging
DOCKER_TAG=$(echo "$REF_NAME" | tr '/' '-')
echo "REF_NAME=${REF_NAME}" >> $GITHUB_ENV
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_ENV
- 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 }}
build-args: |
UW3_BRANCH=${{ env.REF_NAME }}
tags: |
ghcr.io/underworldcode/uw3-base:${{ env.DOCKER_TAG }}-slim
${{ env.IS_RELEASE == 'true' && '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: '{"ref": "${{ env.DOCKER_TAG }}", "is_release": "${{ env.IS_RELEASE }}"}'