Documentation #43
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Create and publish a Docker image | |
on: | |
push: | |
branches: [main] | |
release: | |
types: [published] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: publish-github Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Java environment | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
gpg-private-key: ${{ secrets.MAVEN_CENTRAL_GPG_SIGNING_KEY_SEC }} | |
gpg-passphrase: MAVEN_CENTRAL_GPG_PASSPHRASE | |
- name: Set up NPM | |
uses: actions/setup-node@v3 | |
- name: Build with Maven | |
run: CI=false mvn --batch-mode --update-snapshots package | |
- name: OperationLog in to the Container registry | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@69f6fc9d46f2f8bf0d5491e4aabe0bb8c6a4678a | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
version: v0.7.0 | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |