Maven docker for maven #47
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/checkout@v4.1.1 | |
- 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/setup-java@v4.2.1 | |
with: | |
java-version: 21 | |
distribution: 'zulu' | |
- uses: s4u/maven-settings-action@v3.0.0 | |
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/setup-buildx-action@v3.3.0 | |
id: buildx | |
with: | |
install: true | |
- name: Docker ${{inputs.DOCKER_REGISTRY}}/${{inputs.IMAGE_NAME}}:${{ inputs.IMAGE_TAG }} | |
run: | | |
docker buildx build --platform linux/amd64,linux/arm64 . -f das-producer/Dockerfile -t ${{inputs.DOCKER_REGISTRY}}/${{inputs.IMAGE_NAME}}:${{ inputs.IMAGE_TAG }} --push | |