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:
|
|
|
|
branches:
|
|
|
|
- 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:
|
2023-01-30 21:56:22 +01:00
|
|
|
|
2023-04-22 01:45:11 +02:00
|
|
|
- uses: actions/checkout@v3.5.2
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-01-29 15:10:12 +01:00
|
|
|
- name: Set up JDK 17
|
2023-04-22 01:45:11 +02:00
|
|
|
uses: actions/setup-java@v3.11.0
|
2023-01-29 15:10:12 +01:00
|
|
|
with:
|
|
|
|
java-version: '17'
|
|
|
|
distribution: 'temurin'
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-01-29 15:10:12 +01:00
|
|
|
|
2023-04-22 01:45:11 +02:00
|
|
|
- uses: gradle/gradle-build-action@v2.4.2
|
2023-08-27 14:45:58 +02:00
|
|
|
env:
|
2023-08-27 20:58:20 +02:00
|
|
|
DOCKER_ENABLE_SECURITY: false
|
2023-01-29 15:10:12 +01:00
|
|
|
with:
|
|
|
|
gradle-version: 7.6
|
|
|
|
arguments: clean build
|
|
|
|
|
|
|
|
- name: Make Gradle wrapper executable
|
|
|
|
run: chmod +x gradlew
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-01-29 15:10:12 +01:00
|
|
|
- name: Get version number
|
|
|
|
id: versionNumber
|
|
|
|
run: echo "::set-output name=versionNumber::$(./gradlew printVersion --quiet | tail -1)"
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-01-29 15:10:12 +01:00
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2.1.0
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
2023-04-22 01:41:33 +02:00
|
|
|
password: ${{ secrets.DOCKER_HUB_API }}
|
2023-05-18 00:59:48 +02:00
|
|
|
|
2023-04-22 01:41:33 +02:00
|
|
|
- name: Login to GitHub Container Registry
|
2023-04-22 01:45:11 +02:00
|
|
|
uses: docker/login-action@v2.1.0
|
2023-04-22 01:41:33 +02:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ github.token }}
|
2023-01-29 15:10:12 +01:00
|
|
|
|
2023-06-08 21:25:55 +02:00
|
|
|
- name: Convert repository owner to lowercase
|
|
|
|
id: repoowner
|
|
|
|
run: echo "::set-output name=lowercase::$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')"
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-06-08 23:28:13 +02:00
|
|
|
- name: Generate tags
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v4.4.0
|
|
|
|
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' }}
|
2023-05-13 11:44:22 +02:00
|
|
|
|
2023-05-18 01:03:59 +02:00
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v2.1.0
|
2023-05-18 00:58:28 +02:00
|
|
|
|
2023-05-18 01:03:59 +02:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2.5.0
|
2023-05-18 00:58:28 +02:00
|
|
|
|
2023-06-08 23:28:13 +02:00
|
|
|
- name: Build and push main Dockerfile
|
|
|
|
uses: docker/build-push-action@v4.0.0
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
dockerfile: ./Dockerfile
|
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2023-08-27 14:45:58 +02:00
|
|
|
build-args:
|
|
|
|
VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
2023-06-08 23:28:13 +02:00
|
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|
|
|
2023-05-18 00:58:28 +02:00
|
|
|
|
2023-06-08 23:28:13 +02:00
|
|
|
|
|
|
|
- name: Generate tags ultra-lite
|
|
|
|
id: meta2
|
2023-05-19 01:12:48 +02:00
|
|
|
uses: docker/metadata-action@v4.4.0
|
2023-06-12 17:20:14 +02:00
|
|
|
if: github.ref != 'refs/heads/main'
|
2023-05-19 01:12:48 +02:00
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ secrets.DOCKER_HUB_USERNAME }}/s-pdf
|
2023-06-08 21:25:55 +02:00
|
|
|
ghcr.io/${{ steps.repoowner.outputs.lowercase }}/s-pdf
|
2023-05-19 01:12:48 +02:00
|
|
|
tags: |
|
2023-06-08 23:28:13 +02:00
|
|
|
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' }}
|
2024-02-11 17:47:00 +01:00
|
|
|
|
2023-06-08 23:28:13 +02:00
|
|
|
|
|
|
|
- name: Build and push Dockerfile-ultra-lite
|
2023-05-18 01:03:59 +02:00
|
|
|
uses: docker/build-push-action@v4.0.0
|
2023-06-12 17:20:14 +02:00
|
|
|
if: github.ref != 'refs/heads/main'
|
2023-05-18 01:03:59 +02:00
|
|
|
with:
|
|
|
|
context: .
|
2023-06-08 23:28:13 +02:00
|
|
|
file: ./Dockerfile-ultra-lite
|
2023-05-18 01:03:59 +02:00
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|
2023-06-08 23:28:13 +02:00
|
|
|
tags: ${{ steps.meta2.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta2.outputs.labels }}
|
2023-08-27 14:45:58 +02:00
|
|
|
build-args:
|
|
|
|
VERSION_TAG=${{ steps.versionNumber.outputs.versionNumber }}
|
2024-04-01 19:33:58 +02:00
|
|
|
platforms: linux/amd64,linux/arm64/v8
|