Update docker image #65
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: Build (master) | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- '**' | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Install Graphviz | |
run: sudo apt-get -y install graphviz | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- uses: actions/cache@v2 | |
id: target-cache | |
with: | |
path: ./target/* | |
key: ${{ github.sha }} | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
upload_arc42_pdf: | |
name: Upload Architecture Documentation (PDF) | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/cache@v2 | |
id: target-cache | |
with: | |
path: ./target/* | |
key: ${{ github.sha }} | |
- name: Upload Architecture Documentation | |
uses: actions/upload-artifact@v3 | |
with: | |
name: arc42-doc | |
path: | | |
target/generated-docs/architecture.pdf | |
publish_gh_page: | |
name: Publish GH Page | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/cache@v2 | |
id: target-cache | |
with: | |
path: ./target/* | |
key: ${{ github.sha }} | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: './target/generated-docs' | |
if-no-files-found: error | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
build_and_publish_docker_image: | |
name: Build and Publish Docker Image | |
runs-on: ubuntu-latest | |
needs: [ build ] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v2 | |
id: target-cache | |
with: | |
path: ./target/* | |
key: ${{ github.sha }} | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Get Project Version from POM | |
id: project-version | |
uses: CptMokoena/[email protected] | |
- name: Build and Push (latest) | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./src/main/resources/Dockerfile | |
build-args: | | |
JAR_FILE=ddd-cm-tla-sample-application-${{ steps.project-version.outputs.version }}.jar | |
push: true | |
tags: contextmapper/ddd-cm-tla-sample-application:latest | |
- name: Build and Push (latest) | |
if: github.event_name == 'release' | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./src/main/resources/Dockerfile | |
build-args: | | |
JAR_FILE=ddd-cm-tla-sample-application-${{ steps.project-version.outputs.version }}.jar | |
push: true | |
tags: contextmapper/ddd-cm-tla-sample-application:${{ github.event.release.tag_name }} |