Skip to content

Commit ab19cf1

Browse files
AUR publishing workflow (#6132)
Co-authored-by: aikido-pr-checks[bot] <169896070+aikido-pr-checks[bot]@users.noreply.github.com>
1 parent 3eefabd commit ab19cf1

File tree

3 files changed

+247
-0
lines changed

3 files changed

+247
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Maintainer: Stirling PDF Inc <contact@stirlingpdf.com>
2+
pkgname=stirling-pdf-bin
3+
pkgver=2.7.3
4+
pkgrel=1
5+
pkgdesc="Locally hosted, web-based PDF manipulation tool (desktop app, prebuilt binary)"
6+
arch=('x86_64')
7+
url="https://www.stirling.com"
8+
license=('MIT' 'LicenseRef-Stirling-PDF-Proprietary')
9+
depends=('gtk3' 'webkit2gtk' 'libappindicator-gtk3')
10+
provides=('stirling-pdf')
11+
conflicts=('stirling-pdf' 'stirling-pdf-git')
12+
options=('!strip')
13+
14+
source_x86_64=("${pkgname}-${pkgver}.deb::https://github.com/Stirling-Tools/Stirling-PDF/releases/download/v${pkgver}/Stirling-PDF-linux-x86_64.deb")
15+
sha256sums_x86_64=('PLACEHOLDER_DEB_SHA256')
16+
17+
package() {
18+
# Extract the .deb archive
19+
bsdtar -xf data.tar* -C "${pkgdir}"
20+
21+
# Fix permissions
22+
find "${pkgdir}" -type d -exec chmod 755 {} \;
23+
24+
# Install license
25+
install -Dm644 /dev/stdin "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" <<EOF
26+
Copyright (c) 2025 Stirling PDF Inc
27+
All rights reserved. See https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LICENSE
28+
EOF
29+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Maintainer: Stirling PDF Inc <contact@stirlingpdf.com>
2+
pkgname=stirling-pdf-server-bin
3+
pkgver=2.7.3
4+
pkgrel=1
5+
pkgdesc="Locally hosted, web-based PDF manipulation tool (server JAR, prebuilt)"
6+
arch=('any')
7+
url="https://www.stirling.com"
8+
license=('MIT' 'LicenseRef-Stirling-PDF-Proprietary')
9+
depends=('java-runtime>=21')
10+
provides=('stirling-pdf-server')
11+
conflicts=('stirling-pdf-server' 'stirling-pdf-server-git')
12+
backup=('etc/stirling-pdf-server/settings.yml')
13+
14+
source=("Stirling-PDF-with-login-${pkgver}.jar::https://github.com/Stirling-Tools/Stirling-PDF/releases/download/v${pkgver}/Stirling-PDF-with-login.jar"
15+
"stirling-pdf-server.service"
16+
"stirling-pdf-server.sysusers"
17+
"stirling-pdf-server.tmpfiles")
18+
sha256sums=('PLACEHOLDER_JAR_SHA256'
19+
'PLACEHOLDER_SERVICE_SHA256'
20+
'PLACEHOLDER_SYSUSERS_SHA256'
21+
'PLACEHOLDER_TMPFILES_SHA256')
22+
23+
prepare() {
24+
cat > stirling-pdf-server.service << 'EOF'
25+
[Unit]
26+
Description=Stirling-PDF Server
27+
After=network.target
28+
29+
[Service]
30+
Type=simple
31+
User=stirling-pdf
32+
Group=stirling-pdf
33+
WorkingDirectory=/var/lib/stirling-pdf-server
34+
ExecStart=/usr/bin/java -jar /usr/share/stirling-pdf-server/stirling-pdf-server.jar
35+
Restart=on-failure
36+
RestartSec=5
37+
StandardOutput=journal
38+
StandardError=journal
39+
SyslogIdentifier=stirling-pdf-server
40+
Environment=JAVA_OPTS=-Xmx512m
41+
42+
[Install]
43+
WantedBy=multi-user.target
44+
EOF
45+
46+
cat > stirling-pdf-server.sysusers << 'EOF'
47+
u stirling-pdf - "Stirling-PDF Server" /var/lib/stirling-pdf-server -
48+
EOF
49+
50+
cat > stirling-pdf-server.tmpfiles << 'EOF'
51+
d /var/lib/stirling-pdf-server 0750 stirling-pdf stirling-pdf -
52+
d /var/log/stirling-pdf-server 0750 stirling-pdf stirling-pdf -
53+
EOF
54+
}
55+
56+
package() {
57+
# JAR
58+
install -Dm644 "Stirling-PDF-with-login-${pkgver}.jar" \
59+
"${pkgdir}/usr/share/stirling-pdf-server/stirling-pdf-server.jar"
60+
61+
# Wrapper script
62+
install -Dm755 /dev/stdin "${pkgdir}/usr/bin/stirling-pdf-server" << 'EOF'
63+
#!/bin/sh
64+
exec java $JAVA_OPTS -jar /usr/share/stirling-pdf-server/stirling-pdf-server.jar "$@"
65+
EOF
66+
67+
# systemd unit
68+
install -Dm644 stirling-pdf-server.service \
69+
"${pkgdir}/usr/lib/systemd/system/stirling-pdf-server.service"
70+
71+
# sysusers / tmpfiles
72+
install -Dm644 stirling-pdf-server.sysusers \
73+
"${pkgdir}/usr/lib/sysusers.d/stirling-pdf-server.conf"
74+
install -Dm644 stirling-pdf-server.tmpfiles \
75+
"${pkgdir}/usr/lib/tmpfiles.d/stirling-pdf-server.conf"
76+
77+
# Default config stub
78+
install -dm755 "${pkgdir}/etc/stirling-pdf-server"
79+
install -Dm644 /dev/stdin "${pkgdir}/etc/stirling-pdf-server/settings.yml" << 'EOF'
80+
# Stirling-PDF Server configuration
81+
# See https://github.com/Stirling-Tools/Stirling-PDF for all options
82+
server:
83+
port: 8080
84+
EOF
85+
86+
# License
87+
install -Dm644 /dev/stdin "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" << 'EOF'
88+
MIT License — see https://github.com/Stirling-Tools/Stirling-PDF/blob/main/LICENSE
89+
EOF
90+
}

.github/workflows/aur-publish.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Publish to AUR
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version to publish (e.g. 2.9.2 — no v prefix)"
10+
required: true
11+
type: string
12+
dry_run:
13+
description: "Skip the AUR push (safe test)"
14+
type: boolean
15+
default: true
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
get-release-info:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
version: ${{ steps.info.outputs.version }}
25+
deb_sha256: ${{ steps.hashes.outputs.deb_sha256 }}
26+
jar_sha256: ${{ steps.hashes.outputs.jar_sha256 }}
27+
steps:
28+
- name: Harden Runner
29+
uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0
30+
with:
31+
egress-policy: audit
32+
33+
- name: Extract version from tag or manual input
34+
id: info
35+
env:
36+
DISPATCH_VERSION: ${{ inputs.version }}
37+
RELEASE_TAG: ${{ github.event.release.tag_name }}
38+
run: |
39+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
40+
VERSION="$DISPATCH_VERSION"
41+
else
42+
VERSION="$RELEASE_TAG"
43+
fi
44+
VERSION="${VERSION#v}"
45+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
46+
47+
- name: Download release assets and compute SHA256
48+
id: hashes
49+
env:
50+
VERSION: ${{ steps.info.outputs.version }}
51+
run: |
52+
BASE="https://github.com/Stirling-Tools/Stirling-PDF/releases/download/v${VERSION}"
53+
54+
download_sha256() {
55+
local url="$1"
56+
local file
57+
file=$(basename "$url")
58+
curl -fsSL --retry 3 -o "$file" "$url"
59+
sha256sum "$file" | awk '{print $1}'
60+
}
61+
62+
DEB_SHA=$(download_sha256 "${BASE}/Stirling-PDF-linux-x86_64.deb")
63+
JAR_SHA=$(download_sha256 "${BASE}/Stirling-PDF-with-login.jar")
64+
65+
echo "deb_sha256=$DEB_SHA" >> "$GITHUB_OUTPUT"
66+
echo "jar_sha256=$JAR_SHA" >> "$GITHUB_OUTPUT"
67+
68+
publish-aur:
69+
needs: get-release-info
70+
runs-on: ubuntu-latest
71+
steps:
72+
- name: Harden Runner
73+
uses: step-security/harden-runner@v2
74+
with:
75+
egress-policy: audit
76+
77+
- name: Checkout repository (for PKGBUILD templates)
78+
uses: actions/checkout@v4
79+
80+
- name: Update stirling-pdf-bin PKGBUILD
81+
env:
82+
VERSION: ${{ needs.get-release-info.outputs.version }}
83+
DEB_SHA: ${{ needs.get-release-info.outputs.deb_sha256 }}
84+
run: |
85+
PKGBUILD=".github/aur/stirling-pdf-bin/PKGBUILD"
86+
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "$PKGBUILD"
87+
sed -i "s/^pkgrel=.*/pkgrel=1/" "$PKGBUILD"
88+
sed -i "s/'PLACEHOLDER_DEB_SHA256'/'${DEB_SHA}'/" "$PKGBUILD"
89+
90+
- name: Update stirling-pdf-server-bin PKGBUILD
91+
env:
92+
VERSION: ${{ needs.get-release-info.outputs.version }}
93+
JAR_SHA: ${{ needs.get-release-info.outputs.jar_sha256 }}
94+
run: |
95+
PKGBUILD=".github/aur/stirling-pdf-server-bin/PKGBUILD"
96+
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" "$PKGBUILD"
97+
sed -i "s/^pkgrel=.*/pkgrel=1/" "$PKGBUILD"
98+
sed -i "s/'PLACEHOLDER_JAR_SHA256'/'${JAR_SHA}'/" "$PKGBUILD"
99+
100+
- name: Show updated PKGBUILDs (for dry-run visibility)
101+
run: |
102+
echo "--- stirling-pdf-bin PKGBUILD ---"
103+
cat .github/aur/stirling-pdf-bin/PKGBUILD
104+
echo ""
105+
echo "--- stirling-pdf-server-bin PKGBUILD ---"
106+
cat .github/aur/stirling-pdf-server-bin/PKGBUILD
107+
108+
- name: Publish stirling-pdf-bin to AUR
109+
if: ${{ github.event_name == 'release' || inputs.dry_run == false }}
110+
uses: KSXGitHub/github-actions-deploy-aur@2ac5a4c1d7035885d46b10e3193393be8460b6f1 # v4.1.1
111+
with:
112+
pkgname: stirling-pdf-bin
113+
pkgbuild: .github/aur/stirling-pdf-bin/PKGBUILD
114+
commit_username: Stirling PDF Inc
115+
commit_email: contact@stirlingpdf.com
116+
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
117+
commit_message: "Update to v${{ needs.get-release-info.outputs.version }}"
118+
119+
- name: Publish stirling-pdf-server-bin to AUR
120+
if: ${{ github.event_name == 'release' || inputs.dry_run == false }}
121+
uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
122+
with:
123+
pkgname: stirling-pdf-server-bin
124+
pkgbuild: .github/aur/stirling-pdf-server-bin/PKGBUILD
125+
commit_username: Stirling PDF Inc
126+
commit_email: contact@stirlingpdf.com
127+
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
128+
commit_message: "Update to v${{ needs.get-release-info.outputs.version }}"

0 commit comments

Comments
 (0)