Skip to content

trigger-build

trigger-build #69

Workflow file for this run

name: Build Wolfram Image
on:
push:
branches:
- main
paths:
- "wolfram/**"
- ".github/workflows/build_wolfram.yml"
pull_request:
paths:
- "wolfram/**"
- ".github/workflows/build_wolfram.yml"
workflow_dispatch:
inputs:
no-cache:
description: "Disable cache for build"
required: false
default: false
type: boolean
repository_dispatch:
types: [trigger-build]
jobs:
build:
name: Build and Push Docker Image
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-wolfram
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref_name != github.event.repository.default_branch }}
strategy:
matrix:
wolfram_version: [13.3, 14.1]
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
if: github.ref_name == github.event.repository.default_branch
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx (QEMU)
uses: docker/setup-buildx-action@v3
- name: Login to Github Packages
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
suffix=-${{ matrix.wolfram_version }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,value=${{ matrix.wolfram_version }},suffix=,enable={{is_default_branch}}
type=raw,value=latest,suffix=,enable=${{ github.ref_name == github.event.repository.default_branch && matrix.wolfram_version == '14.1' }}
type=edge,branch=main
images: |
ghcr.io/${{ github.repository }}/wolfram
- name: Build and push
uses: docker/build-push-action@v4
with:
context: wolfram
pull: true
push: ${{ !(github.event_name == 'push' && github.ref_name != github.event.repository.default_branch) }}
platforms: ${{ (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
no-cache: ${{ inputs.no-cache || false }}
cache-from: type=gha
cache-to: type=gha,mode=max,ignore-error=true
build-args: |
WOLFRAM_ENGINE_VERSION=${{ matrix.wolfram_version }}