Enable full boundary Jacobian infrastructure for Stokes solver #45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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*'] # 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: | |
| uw3_branch: | |
| description: 'UW3 branch/tag to clone and build (e.g. v0.99, development). Leave empty to use the triggering branch.' | |
| type: string | |
| default: '' | |
| image_tag: | |
| description: 'Docker image tag override (e.g. v0.99). Leave empty to derive from branch. Sets IS_RELEASE=true if starts with v.' | |
| type: string | |
| default: '' | |
| 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 | |
| REF_TYPE=tag | |
| else | |
| REF_NAME=${GITHUB_REF#refs/heads/} | |
| IS_RELEASE=false | |
| REF_TYPE=branch | |
| fi | |
| # Apply manual dispatch overrides | |
| if [[ -n "${{ inputs.uw3_branch }}" ]]; then | |
| REF_NAME="${{ inputs.uw3_branch }}" | |
| fi | |
| if [[ -n "${{ inputs.image_tag }}" ]]; then | |
| DOCKER_TAG="${{ inputs.image_tag }}" | |
| # Tags starting with v are releases | |
| if [[ "$DOCKER_TAG" == v* ]]; then | |
| IS_RELEASE=true | |
| REF_TYPE=tag | |
| fi | |
| else | |
| # Docker tags cannot contain slashes — sanitize for image tagging | |
| DOCKER_TAG=$(echo "$REF_NAME" | tr '/' '-') | |
| fi | |
| echo "REF_NAME=${REF_NAME}" >> $GITHUB_ENV | |
| echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV | |
| echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_ENV | |
| echo "REF_TYPE=${REF_TYPE}" >> $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: '{"branch": "${{ env.DOCKER_TAG }}", "ref_type": "${{ env.REF_TYPE }}"}' |