Skip to content

Build Stack Images

Build Stack Images #10

name: Build Stack Images
on:
workflow_dispatch:
inputs:
tag:
description: 'Docker image tag'
required: false
default: 'latest'
type: string
stack:
description: 'Which stack to build (leave empty to build all)'
required: false
type: choice
options:
- all
- angular-vanilla
- nextjs-shadcn
- nextjs-vanilla
- nextjs-p5
- nextjs-pixi
default: 'all'
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
app: ${{ (inputs.stack == 'all' && fromJSON('[{"name":"angular-vanilla","dockerfile":"images/AngularVanillaDockerFile"},{"name":"nextjs-shadcn","dockerfile":"images/NextjsShadcnDockerFile"},{"name":"nextjs-vanilla","dockerfile":"images/NextjsVanillaDockerFile"},{"name":"nextjs-p5","dockerfile":"images/NextjsP5DockerFile"},{"name":"nextjs-pixi","dockerfile":"images/NextjsPixiDockerFile"}]')) || fromJSON(format('[{"name":"%s","dockerfile":"images/%sDockerFile"}]', inputs.stack, replace(inputs.stack, '-', ''))) }}

Check failure on line 32 in .github/workflows/build-stack-images.yml

View workflow run for this annotation

GitHub Actions / Build Stack Images

Invalid workflow file

The workflow is not valid. .github/workflows/build-stack-images.yml (Line: 32, Col: 14): Unrecognized function: 'replace'. Located at position 473 within expression: (inputs.stack == 'all' && fromJSON('[{"name":"angular-vanilla","dockerfile":"images/AngularVanillaDockerFile"},{"name":"nextjs-shadcn","dockerfile":"images/NextjsShadcnDockerFile"},{"name":"nextjs-vanilla","dockerfile":"images/NextjsVanillaDockerFile"},{"name":"nextjs-p5","dockerfile":"images/NextjsP5DockerFile"},{"name":"nextjs-pixi","dockerfile":"images/Nex[...] .github/workflows/build-stack-images.yml (Line: 32, Col: 14): Unexpected value '${{ (inputs.stack == 'all' && fromJSON('[{"name":"angular-vanilla","dockerfile":"images/AngularVanillaDockerFile"},{"name":"nextjs-shadcn","dockerfile":"images/NextjsShadcnDockerFile"},{"name":"nextjs-vanilla","dockerfile":"images/NextjsVanillaDockerFile"},{"name":"nextjs-p5","dockerfile":"images/NextjsP5DockerFile"},{"name":"nextjs-pixi","dockerfile":"images/NextjsPixiDockerFile"}]')) || fromJSON(format('[{"name":"%[...]
name: Build ${{ matrix.app.name }} Image
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}-pack-${{ matrix.app.name }}
tags: |
type=raw,value=${{ inputs.tag }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: frontend
file: ${{ matrix.app.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}