setup buildx #18
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 Image | |
on: | |
push: | |
branches: [ "development" ] | |
pull_request: | |
branches: [ "development" ] | |
jobs: | |
image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: github.event_name != 'pull_request' | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/ictu/pseudoniemenservice | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: amd64,arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: "liberica" | |
cache: maven | |
- name: Build Native with Maven | |
if: github.event_name != 'pull_request' | |
run: mvn -ntp -B clean install spring-boot:build-image -Dspring-boot.build-image.imageName=ghcr.io/ictu/pseudoniemenservice:latest | |
- name: Build with Maven | |
if: github.event_name == 'pull_request' | |
run: mvn -ntp -B clean install | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io/ictu/pseudoniemenservice | |
username: ictu | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docker image | |
if: github.event_name != 'pull_request' | |
run: | | |
docker push ghcr.io/ictu/pseudoniemenservice:latest |