Skip to content

Images CI for "dev-py3.11-slim,dev-slim" at refs/heads/dev #54

Images CI for "dev-py3.11-slim,dev-slim" at refs/heads/dev

Images CI for "dev-py3.11-slim,dev-slim" at refs/heads/dev #54

Workflow file for this run

name: Docker images
run-name: Images CI for "${{ inputs.base_image_tags || github.event.client_payload.base_image_tags }}"${{ github.event.client_payload.git_ref && format(' at {0}', github.event.client_payload.git_ref) || '' }}
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:
config:
name: Build config
runs-on: ubuntu-latest
steps:
- id: config
uses: actions/github-script@v7
with:
script: |
let input_tags = process.env.BASE_IMAGE_TAGS_WD || process.env.BASE_IMAGE_TAGS_RD
console.log(`Input raw tags: ${input_tags}`)
let base_image_tags = input_tags.split(',').filter(tag => tag !== '')
if (base_image_tags.length == 0) {
core.setFailed("no valid base image tag")
return
}
let tagsMultiline = base_image_tags.join('\n')
core.setOutput('base_image_tag', base_image_tags[0])
core.setOutput('base_image_tags', tagsMultiline)
core.summary.addHeading('Input tags').addCodeBlock(tagsMultiline).write()
console.log('base_image_tags:')
base_image_tags.forEach(tag => console.log(`- ${tag}`))
env:
BASE_IMAGE_TAGS_WD: ${{ inputs.base_image_tags }}
BASE_IMAGE_TAGS_RD: ${{ github.event.client_payload.base_image_tags }}
outputs:
base_image_tag: ${{ steps.config.outputs.base_image_tag }}
base_image_tags: ${{ steps.config.outputs.base_image_tags }}
# TODO: use digit to replace base image tag
extra:
name: Extra packages
needs: config
uses: ./.github/workflows/image_one.yml
secrets: inherit
with:
dockerfile_name: Dockerfile-extra
build_args: |-
BASE_IMAGE=mcdreforged/mcdreforged:${{ needs.config.outputs.base_image_tag }}
base_image_tags: ${{ needs.config.outputs.base_image_tags }}
image_name: mcdreforged/mcdreforged-extra
image_tag_maker_script: |-
core.setOutput('image_tags', process.env.BASE_IMAGE_TAGS)
openjdk:
name: OpenJDK (jdk${{ matrix.java }}, ${{ matrix.distribution }}${{ matrix.extra == 'true' && ', extra' || '' }})
needs: [config, extra]
strategy:
matrix:
java: ['8', '11', '17', '21']
distribution: ['temurin', 'zulu', 'liberica']
extra: ['false', 'true']
uses: ./.github/workflows/image_one.yml
secrets: inherit
with:
dockerfile_name: Dockerfile-${{ matrix.distribution }}
build_args: |-
BASE_IMAGE=mcdreforged/${{ matrix.extra == 'true' && format('mcdreforged-extra@{0}', needs.extra.outputs.digest) || format('mcdreforged:{0}', needs.config.outputs.base_image_tag) }}
JAVA=${{ matrix.java }}
base_image_tags: ${{ needs.config.outputs.base_image_tags }}
image_name: mcdreforged/mcdreforged-${{ matrix.distribution }}
image_tag_maker_script: |-
let image_tags = []
process.env.BASE_IMAGE_TAGS.split('\n').forEach(tag => {
image_tags.push(`type=raw,value=${tag},enable=${{ matrix.extra == 'false' && matrix.java == '17' }}`)
image_tags.push(`type=raw,value=${tag}-extra,enable=${{ matrix.extra == 'true' && matrix.java == '17' }}`)
image_tags.push(`type=raw,value=${tag}-jdk${{ matrix.java }},enable=${{ matrix.extra == 'false' }}`)
image_tags.push(`type=raw,value=${tag}-jdk${{ matrix.java }}-extra,enable=${{ matrix.extra == 'true' }}`)
})
core.setOutput('image_tags', image_tags.join('\n'))