stirling-pdf-patches/.forgejo/workflows/publish-patch.yaml
Sean Greenawalt 4c193d5f34 Fix typo
2025-09-19 17:27:37 -04:00

86 lines
No EOL
2.9 KiB
YAML

name: Build and Patch Releases
on:
schedule:
- cron: '30 17 * * *' # Runs daily at 5:30 PM
workflow_dispatch:
jobs:
build:
runs-on: docker
container:
image: ghcr.io/catthehacker/ubuntu:act-22.04
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Clone Stirling-PDF Repository
run: |
git clone https://github.com/Stirling-Tools/Stirling-PDF.git
cd Stirling-PDF
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
git checkout $latest_tag
- name: Compare with Latest Published Tag
run: |
latest_published_tag=$(curl -s -u ${{ secrets.TOKEN }} https://git.spgrn.com/v2/_catalog | jq -r '.repositories[]' | grep -oP 'stirling-pdf:\K.*' | sort -V | tail -1 || echo "")
echo "latest_published_tag=$latest_published_tag" >> $GITHUB_ENV
if [ -z "$latest_published_tag" ]; then
echo "No published tag found. Proceeding with the build."
elif [ "$latest_tag" = "$latest_published_tag" ]; then
echo "Image already exists. Exiting."
exit 0
fi
- name: Apply Patches
run: |
cd Stirling-PDF
git apply --reject --whitespace=fix ../patches/*.patch
- name: Set up JDK 17
uses: https://github.com/actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 # v4.7.0
with:
java-version: "17"
distribution: "temurin"
- uses: https://github.com/gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
with:
gradle-version: 8.12
- name: Run Gradle Command
run: ./gradle clean build
env:
DOCKER_ENABLE_SECURITY: false
- name: Login to Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: git.spgrn.com
username: seang96
password: ${{ secrets.TOKEN }}
- name: Generate tags fat
id: meta3
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: |
git.spgrn.com/${{ github.repository_owner }}/s-pdf
git.spgrn.com/${{ github.repository_owner }}/stirling-pdf
tags: |
type=raw,value=${{ env.latest_tag }}-fat
type=raw,value=latest-fat
- name: Build and push main Dockerfile fat
id: build-push-fat
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.fat
push: true
tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }}
build-args: VERSION_TAG=${{ env.latest_tag }}
platforms: linux/amd64