Images CI for "2.13.1-py3.11,2.13-py3.11,2.13.1,2.13,latest" from upstream #817 at "refs/tags/v2.13.1" #366
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 CI | |
run-name: |- | |
Images CI for "${{ inputs.base_image_tags || github.event.client_payload.base_image_tags }}"${{ github.event.client_payload.git_ref && format(' from upstream #{0} at "{1}"', github.event.client_payload.run_number, github.event.client_payload.git_ref) || '' }} | |
concurrency: | |
group: tags:${{ inputs.base_image_tags || github.event.client_payload.base_image_tags }} | |
cancel-in-progress: false | |
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", or just "dev" | |
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 inputTags = process.env.BASE_IMAGE_TAGS_WD || process.env.BASE_IMAGE_TAGS_RD | |
console.log(`Input raw tags: ${inputTags}`) | |
let baseImageTags = inputTags.split(',').filter(tag => tag !== '') | |
if (baseImageTags.length === 0) { | |
core.setFailed("no valid base image tag") | |
return | |
} | |
// use digest whenever possible. fallback to tag name if digest not found | |
let baseDigest = process.env.BASE_IMAGE_DIGEST | |
let baseImage = baseDigest ? `mcdreforged/mcdreforged@${baseDigest}` : `mcdreforged/mcdreforged:${baseImageTags[0]}` | |
core.setOutput('base_image', baseImage) | |
let tagsMultiline = baseImageTags.join('\n') | |
core.setOutput('base_target_tags', tagsMultiline) | |
core.summary. | |
addRaw('### Input Tags\n', true).addRaw('```', true).addRaw(inputTags, true).addRaw('```\n', true). | |
addRaw('### Base Image\n', true).addRaw('```', true).addRaw(baseImage, true).addRaw('```\n', true). | |
addRaw('### Base Target Tags\n', true).addRaw('```', true).addRaw(tagsMultiline, true).addRaw('```\n', true). | |
write() | |
env: | |
BASE_IMAGE_TAGS_WD: ${{ inputs.base_image_tags }} | |
BASE_IMAGE_TAGS_RD: ${{ github.event.client_payload.base_image_tags }} | |
BASE_IMAGE_DIGEST: ${{ github.event.client_payload.digest }} | |
outputs: | |
base_image: ${{ steps.config.outputs.base_image }} | |
base_target_tags: ${{ steps.config.outputs.base_target_tags }} | |
extra: | |
name: Extra packages | |
needs: config | |
uses: ./.github/workflows/image_one.yml | |
secrets: inherit | |
with: | |
dockerfile_name: Dockerfile-extra | |
build_args: |- | |
BASE_IMAGE=${{ needs.config.outputs.base_image }} | |
base_target_tags: ${{ needs.config.outputs.base_target_tags }} | |
image_name: mcdreforged/mcdreforged-extra | |
image_tag_maker_script: |- | |
core.setOutput('target_tags', process.env.BASE_TARGET_TAGS) | |
openjdk: | |
name: OpenJDK (jdk${{ matrix.java }}, ${{ matrix.distribution }}${{ matrix.extra == 'true' && ', extra' || '' }}) | |
needs: [config, extra] | |
strategy: | |
fail-fast: false | |
matrix: | |
java: ['8', '11', '17', '21'] | |
distribution: ['temurin', 'corretto', 'zulu'] | |
extra: ['false', 'true'] | |
uses: ./.github/workflows/image_one.yml | |
secrets: inherit | |
with: | |
dockerfile_name: Dockerfile-openjdk-${{ matrix.distribution }} | |
build_args: |- | |
BASE_IMAGE=${{ matrix.extra == 'true' && format('mcdreforged/mcdreforged-extra@{0}', needs.extra.outputs.digest) || needs.config.outputs.base_image }} | |
JAVA=${{ matrix.java }} | |
base_target_tags: ${{ needs.config.outputs.base_target_tags }} | |
image_name: mcdreforged/mcdreforged-${{ matrix.distribution }} | |
image_tag_maker_script: |- | |
let targetTags = [] | |
process.env.BASE_TARGET_TAGS.split('\n').forEach(tag => { | |
targetTags.push(`type=raw,value=${tag},enable=${{ matrix.extra == 'false' && matrix.java == '21' }}`) | |
targetTags.push(`type=raw,value=${tag}-extra,enable=${{ matrix.extra == 'true' && matrix.java == '21' }}`) | |
targetTags.push(`type=raw,value=${tag}-jdk${{ matrix.java }},enable=${{ matrix.extra == 'false' }}`) | |
targetTags.push(`type=raw,value=${tag}-jdk${{ matrix.java }}-extra,enable=${{ matrix.extra == 'true' }}`) | |
}) | |
core.setOutput('target_tags', targetTags.join('\n')) |