Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions .github/scripts/verify-central.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Verifies the JPDFium artifact set, then runs a smoke against it.
# MODE=staging Central Portal validated-deployment downloads (before release)
# MODE=released repo1.maven.org (after the deployment is released)
# MODE=r2 the Stirling Maven repo at R2_REPO_URL (staging prefix or root)
# Called by release.yml with VERSION and PLATFORM in the environment.
set -euo pipefail

MODE="${MODE:?MODE must be staging or released}"
MODE="${MODE:?MODE must be staging, released or r2}"
VERSION="${VERSION:?VERSION is required}"
PLATFORM="${PLATFORM:?PLATFORM is required}"
GROUP_PATH="com/stirling"
Expand All @@ -21,6 +22,11 @@ case "$MODE" in
REPO_URL="https://repo1.maven.org/maven2"
PORTAL_TOKEN=""
;;
r2)
REPO_URL="${R2_REPO_URL:-https://maven.stirlingpdf.com}"
REPO_URL="${REPO_URL%/}"
PORTAL_TOKEN=""
;;
*)
echo "ERROR: unknown MODE '$MODE'" >&2
exit 2
Expand Down Expand Up @@ -160,14 +166,20 @@ repositories {
if (System.getenv("VERIFY_STAGING") == "true") {
maven {
url = uri(System.getenv("VERIFY_REPO_URL") + "/")
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = System.getenv("VERIFY_TOKEN")
if (!System.getenv("VERIFY_TOKEN").isNullOrEmpty()) {
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = System.getenv("VERIFY_TOKEN")
}
authentication { create<HttpHeaderAuthentication>("header") }
}
authentication { create<HttpHeaderAuthentication>("header") }
}
}
mavenCentral()
mavenCentral {
if (System.getenv("VERIFY_STAGING") == "true") {
content { excludeGroup("com.stirling") }
}
}
}

dependencies {
Expand Down Expand Up @@ -249,7 +261,7 @@ if [ "$VIPS_SUPPORTED" != "1" ]; then
export VERIFY_VIPS=false
fi

if [ "$MODE" = "staging" ]; then
if [ "$MODE" = "staging" ] || [ "$MODE" = "r2" ]; then
export VERIFY_STAGING=true
export VERIFY_REPO_URL="$REPO_URL"
export VERIFY_TOKEN="$PORTAL_TOKEN"
Expand Down
102 changes: 102 additions & 0 deletions .github/workflows/mirror-central-to-r2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Copy Central releases to maven.stirlingpdf.com

on:
workflow_dispatch:
inputs:
versions:
description: 'Versions to copy: all, or a list such as 1.2.0,1.3.0'
required: true
default: 'all'
latest:
description: 'With all, copy only this many of the newest versions (smoke needs 1.1.0 or newer)'
required: false
default: '5'
destination:
description: 'Bucket prefix to copy to, e.g. staging/mirror-test/. Empty is the live repo root.'
required: false
default: ''
smoke:
description: 'Also run the six-platform smoke against each copied version'
required: false
default: false
type: boolean
dryRun:
description: 'Only list what would be copied'
required: false
default: false
type: boolean

permissions:
contents: read

jobs:
copy:
name: Copy from Maven Central
runs-on: ubuntu-latest
environment: maven
concurrency:
group: stirling-maven
cancel-in-progress: false
outputs:
versions: ${{ steps.mirror.outputs.versions }}
url: ${{ steps.mirror.outputs.url }}
steps:
- name: Refuse smoke for releases older than its artifact set
if: ${{ inputs.smoke && inputs.versions != 'all' }}
env:
VERSIONS: ${{ inputs.versions }}
run: |
for v in $(echo "$VERSIONS" | tr -s ', ' '\n'); do
if [ "$(printf '%s\n1.1.0\n' "$v" | sort -V | head -1)" != 1.1.0 ]; then
echo "ERROR: smoke expects the jpdfium-vips modules added in 1.1.0; $v predates them. Copy it without smoke."
exit 1
fi
done

- id: mirror
uses: Stirling-Tools/maven-r2-publish/mirror@137b6b342d035155657660adf93da370b518ed8d # main
with:
group: com.stirling
artifact: jpdfium
versions: ${{ inputs.versions }}
latest: ${{ inputs.latest }}
destination: ${{ inputs.destination }}
dry-run: ${{ inputs.dryRun }}
endpoint: ${{ secrets.R2_ENDPOINT }}
access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
bucket: ${{ vars.R2_BUCKET || 'stirling-maven' }}

smoke:
name: Smoke ${{ matrix.version }} (${{ matrix.platform }})
needs: copy
if: ${{ inputs.smoke && !inputs.dryRun && needs.copy.outputs.versions != '[]' }}
strategy:
fail-fast: false
matrix:
version: ${{ fromJSON(needs.copy.outputs.versions) }}
platform: [linux-x64, linux-arm64, darwin-x64, darwin-arm64, windows-x64, windows-arm64]
include:
- { platform: linux-x64, runner: ubuntu-24.04 }
- { platform: linux-arm64, runner: ubuntu-24.04-arm }
- { platform: darwin-x64, runner: macos-15-intel }
- { platform: darwin-arm64, runner: macos-15 }
- { platform: windows-x64, runner: windows-latest }
- { platform: windows-arm64, runner: windows-11-arm }
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@f548e57e544e1ff5a4c46bf1e1b8685f8e4a348a # v7.0.1

- uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v5.7.0
with:
distribution: ${{ matrix.platform == 'windows-arm64' && 'microsoft' || 'temurin' }}
java-version: '25'

- name: Verify every artifact and run the smoke
shell: bash
env:
MODE: r2
R2_REPO_URL: ${{ needs.copy.outputs.url }}
VERSION: ${{ matrix.version }}
PLATFORM: ${{ matrix.platform }}
run: bash .github/scripts/verify-central.sh
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Loading
Loading