Skip to content

Docker images CI

Docker images CI #42

Workflow file for this run

name: Docker images

Check failure on line 1 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / Docker images

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 2, Col: 11): Unexpected symbol: '+'. Located at position 47 within expression: github.event.client_payload.git_ref && ' at ' + github.event.client_payload.git_ref || ''
run-name: Images CI for "${{ inputs.base_image_tags || github.event.client_payload.base_image_tags }}"${{ github.event.client_payload.git_ref && ' at ' + 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}`))
openjdk_tags = []
base_image_tags.forEach(tag => {
openjdk_tags.push(`type=raw,value=${tag}` + ",enable=${{ matrix.extra == 'false' && matrix.java == '17' }}")
openjdk_tags.push(`type=raw,value=${tag}` + "-extra,enable=${{ matrix.extra == 'true' && matrix.java == '17' }}")
openjdk_tags.push(`type=raw,value=${tag}` + "-jdk${{ matrix.java }},enable=${{ matrix.extra == 'false' }}")
openjdk_tags.push(`type=raw,value=${tag}` + "-jdk${{ matrix.java }}-extra,enable=${{ matrix.extra == 'true' }}")
})
core.setOutput('openjdk_tags', openjdk_tags.join('\n'))
console.log('openjdk_tags:')
openjdk_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 }}
openjdk_tags: ${{ steps.config.outputs.openjdk_tags }}
extra:
needs: config
uses: ./.github/workflows/image_one.yml
secrets: inherit
with:
job_name: Extra packages
dockerfile_name: Dockerfile-extra
build_args: |-
BASE_IMAGE=mcdreforged/mcdreforged:${{ needs.config.outputs.base_image_tag }}
image_name: mcdreforged/mcdreforged-extra
image_tags: ${{ needs.config.outputs.base_image_tags }}
openjdk:
needs: extra
strategy:
matrix:
java: ['8', '11', '17', '21']
distribution: ['temurin', 'zulu', 'liberica']
extra: ['false', 'true']
uses: ./.github/workflows/image_one.yml
secrets: inherit
with:
job_name: OpenJDK (jdk${{ matrix.java }}, ${{ matrix.distribution }}${{ matrix.extra == 'true' && ', extra' || '' }})
dockerfile_name: Dockerfile-${{ matrix.distribution }}
build_args: |-
BASE_IMAGE=mcdreforged/${{ matrix.extra == 'true' && 'mcdreforged-extra' || 'mcdreforged' }}:${{ needs.config.outputs.base_image_tag }}
JAVA=${{ matrix.java }}
image_name: mcdreforged/mcdreforged-${{ matrix.distribution }}
image_tags: ${{ needs.config.outputs.openjdk_tags }}