Merge pull request #26 from Gabriel-Trintinalia/fix-build-body-conten… #17
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: CI | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [released] | |
jobs: | |
docker_publish: | |
if: github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
env: | |
architecture: "amd64" | |
GRADLE_OPTS: "-Xmx6g -Dorg.gradle.parallel=true -Dorg.gradle.workers.max=4" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Set up QEMU for Docker | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Check Dockerfile syntax | |
run: | | |
docker run --rm -i hadolint/hadolint < docker/Dockerfile | |
- name: Login to Docker Hub for self hosted | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER_RW }} | |
password: ${{ secrets.DOCKER_PAT_RW }} | |
- name: Get the version | |
if: github.event_name == 'release' | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} | |
- name: Build and Publish Docker Image | |
run: | | |
if [ "${{ github.event_name }}" == "release" ]; then \ | |
./gradlew -PdockerOrgName=${{ secrets.DOCKER_ORG_NAME }} -Pdocker-platform=linux/arm64 distDocker -PreleaseVersion=${{ steps.get_version.outputs.VERSION }}; \ | |
else \ | |
./gradlew -PdockerOrgName=${{ secrets.DOCKER_ORG_NAME }} -Pdocker-platform=linux/arm64 distDocker; \ | |
fi |