90 lines
No EOL
2.6 KiB
YAML
90 lines
No EOL
2.6 KiB
YAML
name: Push Docker Image with VersionNumber
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
- main
|
|
jobs:
|
|
push:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
config: [
|
|
{ dockerfile: "./Dockerfile", tagSuffix: "" },
|
|
{ dockerfile: "./Dockerfile-ultra-lite", tagSuffix: "-ultra-lite" },
|
|
{ dockerfile: "./Dockerfile-lite", tagSuffix: "-lite" }
|
|
]
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3.5.2
|
|
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v3.11.0
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
|
|
|
|
- uses: gradle/gradle-build-action@v2.4.2
|
|
with:
|
|
gradle-version: 7.6
|
|
arguments: clean build
|
|
|
|
- name: Make Gradle wrapper executable
|
|
run: chmod +x gradlew
|
|
|
|
- name: Get version number
|
|
id: versionNumber
|
|
run: echo "::set-output name=versionNumber::$(./gradlew printVersion --quiet | tail -1)"
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v2.1.0
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_API }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2.1.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.token }}
|
|
|
|
- name: Convert repository owner to lowercase
|
|
id: repoowner
|
|
run: echo "::set-output name=lowercase::$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')"
|
|
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2.1.0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2.5.0
|
|
|
|
|
|
- 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 }}${{ matrix.config.tagSuffix }},enable=${{ github.ref == 'refs/heads/master' }}
|
|
type=raw,value=latest${{ matrix.config.tagSuffix }},enable=${{ github.ref == 'refs/heads/master' }}
|
|
type=raw,value=alpha,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
- name: Build and push Dockerfile
|
|
uses: docker/build-push-action@v4.0.0
|
|
with:
|
|
context: .
|
|
dockerfile: ${{ matrix.config.dockerfile }}
|
|
push: true
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64,linux/arm64/v8
|
|
|