Add workflow #1

Merged
seang96 merged 17 commits from test into main 2025-09-19 23:10:47 +00:00
Showing only changes of commit 0e0706d342 - Show all commits

cleanup workflow
Some checks are pending
Build and Patch Releases / check-latest-tag (push) Waiting to run
Build and Patch Releases / build (push) Blocked by required conditions

Sean Greenawalt 2025-09-19 18:38:23 -04:00

View file

@ -9,34 +9,43 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
check-latest-tag:
runs-on: ubuntu-latest
outputs:
update_available: ${{ steps.check.outputs.update_available }}
latest_tag: ${{ steps.get_tag.outputs.latest_tag }}
steps:
- name: Clone Stirling-PDF Repository
id: get_tag
run: |
latest_tag=$(curl -s https://api.github.com/repos/Stirling-Tools/Stirling-PDF/tags | jq -r '.[0].name')
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
- name: Compare with Latest Published Tag
id: check
run: |
latest_published_tag=$(curl -s -u :${{ secrets.TOKEN }} https://git.spgrn.com/v2/seang96/stirling-pdf/tags/list 2>/dev/null | jq -r '.tags[]' 2>/dev/null | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-fat$' 2>/dev/null | sed 's/-fat$//' 2>/dev/null | sort -V | tail -1 || echo "")
if [ "$latest_tag" = "$latest_published_tag" ]; then
echo "update_available=true" >> $GITHUB_ENV
echo "Image already exists. Exiting."
else
echo "update_available=false" >> $GITHUB_ENV
echo "No published tag found. Proceeding with the build."
fi
build: build:
needs: [check-latest-tag]
if: needs.check-latest-tag.outputs.update_available == 'false'
runs-on: docker runs-on: docker
container: container:
image: ghcr.io/catthehacker/ubuntu:act-22.04 image: ghcr.io/catthehacker/ubuntu:act-22.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Clone Stirling-PDF Repository - name: Clone Stirling-PDF Repository
run: | run: |
git clone https://github.com/Stirling-Tools/Stirling-PDF.git git clone --branch ${{ needs.check-latest-tag.outputs.latest_tag }}} --depth 1 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/seang96/stirling-pdf/tags/list | jq -r '.tags[]' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-fat$' | sort -V | tail -1 | sed 's/-fat$//')
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 - name: Apply Patches
run: | run: |
@ -76,7 +85,7 @@ jobs:
git.spgrn.com/${{ github.repository_owner }}/s-pdf git.spgrn.com/${{ github.repository_owner }}/s-pdf
git.spgrn.com/${{ github.repository_owner }}/stirling-pdf git.spgrn.com/${{ github.repository_owner }}/stirling-pdf
tags: | tags: |
type=raw,value=${{ env.latest_tag }}-fat type=raw,value=${{ needs.check-latest-tag.outputs.latest_tag }}-fat
type=raw,value=latest-fat type=raw,value=latest-fat
- name: Build and push main Dockerfile fat - name: Build and push main Dockerfile fat
@ -88,5 +97,5 @@ jobs:
push: true push: true
tags: ${{ steps.meta3.outputs.tags }} tags: ${{ steps.meta3.outputs.tags }}
labels: ${{ steps.meta3.outputs.labels }} labels: ${{ steps.meta3.outputs.labels }}
build-args: VERSION_TAG=${{ env.latest_tag }} build-args: VERSION_TAG=${{ needs.check-latest-tag.outputs.latest_tag }}
platforms: linux/amd64 platforms: linux/amd64