Docker images CI #9
This file contains 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: Docker images | |
on: | |
workflow_dispatch: | |
inputs: | |
base_image_tags: | |
description: | | |
List of image tags of the mcdreforged/mcdreforged image for the workflow to build as the base images, separated with ",". | |
For example: "1.2.3,1.2.3-slim,1.2.3-py3.11,1.2.3-py3.11-slim" | |
type: string | |
required: true | |
repository_dispatch: | |
types: [trigger-workflow] | |
jobs: | |
build_matrix: | |
name: Build matrix from input | |
runs-on: ubuntu-latest | |
steps: | |
- name: Build matrix | |
id: matrix | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
let matrix = {'include': []} | |
let tags = process.env.BASE_IMAGE_TAGS.split(',').filter(tag => tag !== '') | |
tags.forEach(tag => matrix.include.push({'base_image_tag': tag})) | |
console.log(`matrix:`) | |
console.log(JSON.stringify(matrix, null, 2)) | |
core.setOutput('matrix', JSON.stringify(matrix)) | |
core.summary.addHeading('Input tags').addCodeBlock(tags.join('\n')).write() | |
env: | |
BASE_IMAGE_TAGS: ${{ inputs.base_image_tags }} | |
outputs: | |
matrix: ${{ steps.matrix.outputs.matrix }} | |
images: | |
needs: build_matrix | |
strategy: | |
matrix: ${{ fromJson(needs.build_matrix.outputs.matrix) }} | |
uses: ./.github/workflows/image_derivatives.yml | |
secrets: inherit | |
with: | |
source_tag: ${{ matrix.base_image_tag }} |