docker #26
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 | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '0 5 15 * *' | |
jobs: | |
docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@6c3b1c91e8873ae0c705b0709f957c7a6a5eaf10 | |
with: | |
disable-sudo: true | |
egress-policy: audit #outbound hosts constantly subject to change by action providers | |
- uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017 | |
with: | |
fetch-depth: '0' | |
ref: master | |
- name: Set up JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Download Maven release | |
id: mvnrel | |
run: | | |
git config --global user.email "jens.dibbern@gmail.com" | |
git config --global user.name "datengaertnerei" | |
mkdir -p target | |
export MVNVER=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//') | |
mvn dependency:copy \ | |
-Dartifact=com.datengaertnerei.test:data-service:${MVNVER} \ | |
-DoutputDirectory=target \ | |
--global-settings .github/settings.xml | |
# preserve branch and tag info | |
echo "dockertag=${MVNVER}" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
datengaertner/test-data-service:latest | |
datengaertner/test-data-service:${{steps.mvnrel.outputs.dockertag}} |