Maven docker for maven #31
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: Maven docker for maven | |
on: | |
workflow_dispatch: | |
inputs: | |
DOCKER_REGISTRY: | |
required: true | |
DOCKER_REGISTRY_USER: | |
required: true | |
DOCKER_REGISTRY_TOKEN: | |
required: true | |
IMAGE_NAME: | |
default: "das-producer" | |
IMAGE_TAG: | |
required: true | |
jobs: | |
make-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Masking inputs | |
id: add_mask | |
run: | | |
INP_SECRET_TOKEN=$(jq -r '.inputs.DOCKER_REGISTRY_TOKEN' $GITHUB_EVENT_PATH) | |
echo ::add-mask::$INP_SECRET_TOKEN | |
echo DOCKER_REGISTRY_TOKEN="$INP_SECRET_TOKEN" >> $GITHUB_ENV | |
- uses: actions/[email protected] | |
- name: Docker login | |
run: echo ${DOCKER_REGISTRY_TOKEN}| docker login ${{ inputs.DOCKER_REGISTRY }} --username ${{ inputs.DOCKER_REGISTRY_USER }} --password-stdin | |
- name: Set up JDK 21 | |
uses: actions/[email protected] | |
with: | |
java-version: 21 | |
distribution: 'zulu' | |
- uses: s4u/[email protected] | |
with: | |
servers: | | |
[{ | |
"id": "fiberoptics-das-public-schemas", | |
"username": "${{secrets.PUBLIC_SCHEMA_USER}}", | |
"password": "${{ secrets.PUBLIC_SCHEMA_TOKEN }}" | |
}] | |
- name: Build, test and package | |
run: ./mvnw -B clean test compile | |
- uses: docker/[email protected] | |
id: buildx | |
with: | |
install: true | |
- name: Docker | |
run: | | |
docker buildx build --platform linux/amd64,linux/arm64 . -f das-producer/Dockerfile -t ${{inputs.DOCKER_REGISTRY}}/${{inputs.IMAGE_NAME}}:${{ inputs.IMAGE_TAG }} --push | |