Prepare email backup #28
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: Flightlog Build | |
on: [push] | |
jobs: | |
build-application: | |
name: Build application | |
runs-on: ubuntu-latest | |
environment: dockerhub | |
permissions: | |
contents: write | |
checks: write | |
id-token: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
cache-dependency-path: 'pom.xml' | |
- name: Build application | |
run: |- | |
mvn --batch-mode clean package | |
- name: Publish JUnit results | |
uses: mikepenz/action-junit-report@v4 | |
if: always() | |
with: | |
report_paths: 'target/surefire-reports/*.xml' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | |
tags: | | |
${{ secrets.DOCKERHUB_USERNAME }}/flightlog:latest | |
${{ secrets.DOCKERHUB_USERNAME }}/flightlog:${{ github.ref_name }} | |
- name: Update Docker Hub Description | |
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | |
uses: peter-evans/dockerhub-description@v4 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: ${{ secrets.DOCKERHUB_USERNAME }}/flightlog | |
readme-filepath: ./README.md | |
enable-url-completion: true | |
- name: Create Release | |
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref_name }} | |
body: | | |
Release automatically created by GitHub Actions | |
draft: false | |
prerelease: false |