2023-01-29 15:10:12 +01:00
|
|
|
name: Push Docker Image with VersionNumber
|
|
|
|
|
|
|
|
on:
|
2023-04-22 01:46:27 +02:00
|
|
|
workflow_dispatch:
|
2023-01-29 15:10:12 +01:00
|
|
|
push:
|
2024-02-11 17:47:00 +01:00
|
|
|
branches:
|
2023-01-29 15:10:12 +01:00
|
|
|
- master
|
|
|
|
- main
|
2024-03-13 23:18:15 +01:00
|
|
|
|
2024-01-03 19:46:29 +01:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
2023-01-29 15:10:12 +01:00
|
|
|
jobs:
|
2023-01-29 19:41:33 +01:00
|
|
|
push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-04-21 17:30:17 +02:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Set up JDK 17
|
|
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
java-version: "17"
|
|
|
|
distribution: "temurin"
|
|
|
|
|
|
|
|
- uses: gradle/actions/setup-gradle@v3
|
|
|
|
with:
|
2024-05-27 19:12:06 +02:00
|
|
|
gradle-version: 8.7
|
2024-04-21 17:30:17 +02:00
|
|
|
|
|
|
|
- name: Run Gradle Command
|
|
|
|
run: ./gradlew clean build
|
|
|
|
env:
|
|
|
|
DOCKER_ENABLE_SECURITY: false
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Get version number
|
|
|
|
id: versionNumber
|
|
|
|
run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_API }}
|
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ github.token }}
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
|
|
|
- name: Convert repository owner to lowercase
|
|
|
|
id: repoowner
|
|
|
|
run: echo "lowercase=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Generate tags
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ secrets.DOCKER_HUB_USERNAME }}/s-pdf
|
|
|
|
ghcr.io/${{ steps.repoowner.outputs.lowercase }}/s-pdf
|
|
|
|
tags: |
|
|
|
|
type=raw,value=${{ steps.versionNumber.outputs.versionNumber }},enable=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
type=raw,value=alpha,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
|
|
|
|
- name: Build and push main Dockerfile
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
|
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
|
|
|
|
- name: Generate tags ultra-lite
|
|
|
|
id: meta2
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
if: github.ref != 'refs/heads/main'
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ secrets.DOCKER_HUB_USERNAME }}/s-pdf
|
|
|
|
ghcr.io/${{ steps.repoowner.outputs.lowercase }}/s-pdf
|
|
|
|
tags: |
|
|
|
|
type=raw,value=${{ steps.versionNumber.outputs.versionNumber }}-ultra-lite,enable=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
type=raw,value=latest-ultra-lite,enable=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
|
|
|
|
- name: Build and push Dockerfile-ultra-lite
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
if: github.ref != 'refs/heads/main'
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile-ultra-lite
|
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
tags: ${{ steps.meta2.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta2.outputs.labels }}
|
|
|
|
build-args: VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
|
|
|
platforms: linux/amd64,linux/arm64/v8
|