Add workflow #1
2 changed files with 106 additions and 76 deletions
106
.forgejo/workflows/publish-patch.yaml
Normal file
106
.forgejo/workflows/publish-patch.yaml
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
name: Build and Patch Releases
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
schedule:
|
||||||
|
- cron: '30 17 * * *' # Runs daily at 5:30 PM
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-latest-tag:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: ghcr.io/catthehacker/ubuntu:act-22.04
|
||||||
|
outputs:
|
||||||
|
update_available: ${{ steps.check.outputs.update_available }}
|
||||||
|
latest_tag: ${{ steps.get_tag.outputs.latest_tag }}
|
||||||
|
steps:
|
||||||
|
- name: Get Stirling-PDF Repository latest tag
|
||||||
|
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_OUTPUT
|
||||||
|
echo "Latest tag: $latest_tag"
|
||||||
|
|
||||||
|
- 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 "")
|
||||||
|
echo "Latest published tag: $latest_published_tag"
|
||||||
|
if [ "$latest_tag" = "$latest_published_tag" ]; then
|
||||||
|
echo "update_available=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "Image already exists."
|
||||||
|
else
|
||||||
|
echo "update_available=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "No published tag found."
|
||||||
|
fi
|
||||||
|
|
||||||
|
build:
|
||||||
|
needs: [check-latest-tag]
|
||||||
|
if: needs.check-latest-tag.outputs.update_available == 'false' || github.event_name != 'schedule'
|
||||||
|
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: |
|
||||||
|
echo "Latest tag: ${{ needs.check-latest-tag.outputs.latest_tag }}"
|
||||||
|
git clone --branch "${{ needs.check-latest-tag.outputs.latest_tag }}" --depth 1 https://github.com/Stirling-Tools/Stirling-PDF.git
|
||||||
|
|
||||||
|
- 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"
|
||||||
|
|
||||||
|
- name: Set up Gradle
|
||||||
|
uses: https://github.com/gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b # v4.3.0
|
||||||
|
with:
|
||||||
|
gradle-version: 8.12
|
||||||
|
|
||||||
|
- name: Run Gradle Command
|
||||||
|
run: |
|
||||||
|
cd Stirling-PDF
|
||||||
|
./gradlew 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=${{ needs.check-latest-tag.outputs.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: ./Stirling-PDF
|
||||||
|
file: ./Stirling-PDF/Dockerfile.fat
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta3.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta3.outputs.labels }}
|
||||||
|
build-args: VERSION_TAG=${{ needs.check-latest-tag.outputs.latest_tag }}
|
||||||
|
platforms: linux/amd64
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
diff --git a/.forgejo/workflows/package.yaml b/.forgejo/workflows/package.yaml
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000..46a3954c
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.forgejo/workflows/package.yaml
|
|
||||||
@@ -0,0 +1,69 @@
|
|
||||||
+name: Build Patched Release
|
|
||||||
+
|
|
||||||
+on:
|
|
||||||
+ push:
|
|
||||||
+ branches:
|
|
||||||
+ - 'patches/*'
|
|
||||||
+
|
|
||||||
+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: 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: ./gradlew clean build
|
|
||||||
+ env:
|
|
||||||
+ DOCKER_ENABLE_SECURITY: false
|
|
||||||
+
|
|
||||||
+ - name: Get version number
|
|
||||||
+ id: versionNumber
|
|
||||||
+ run: echo "versionNumber=$(./gradlew printVersion --quiet | tail -1)" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Login to Container Registry
|
|
||||||
+ uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
|
||||||
+ with:
|
|
||||||
+ registry: git.spgrn.com
|
|
||||||
+ username: seang96
|
|
||||||
+ password: ${{ secrets.TOKEN }}
|
|
||||||
+
|
|
||||||
+ - name: Convert repository owner to lowercase
|
|
||||||
+ id: repoowner
|
|
||||||
+ run: echo "lowercase=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT
|
|
||||||
+
|
|
||||||
+ - name: Generate tags fat
|
|
||||||
+ id: meta3
|
|
||||||
+ uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
|
|
||||||
+ with:
|
|
||||||
+ images: |
|
|
||||||
+ git.spgrn.com/${{ steps.repoowner.outputs.lowercase }}/s-pdf
|
|
||||||
+ git.spgrn.com/${{ steps.repoowner.outputs.lowercase }}/stirling-pdf
|
|
||||||
+ tags: |
|
|
||||||
+ type=raw,value=${{ steps.versionNumber.outputs.versionNumber }}-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=${{ steps.versionNumber.outputs.versionNumber }}
|
|
||||||
+ platforms: linux/amd64
|
|
||||||
\ No newline at end of file
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue