mirror of
https://github.com/lancedb/lancedb.git
synced 2026-12-03 07:45:17 +00:00
fix(ci): retry Java releases from existing tags (#5315)
Add manual dispatch for Java publication after the original GitHub Actions rerun window expires. The workflow resolves the supplied tag, verifies the Maven parent and core versions, and shares the existing signing and deploy steps with tag-triggered runs. Stable tags use Maven Central and beta tags use Fury.
This commit is contained in:
@@ -18,6 +18,12 @@ on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/java-publish.yml
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Existing LanceDB release tag, e.g. v0.42.1"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -31,8 +37,53 @@ jobs:
|
||||
run:
|
||||
working-directory: ./java
|
||||
steps:
|
||||
- name: Select release tag
|
||||
if: github.event_name != 'pull_request'
|
||||
id: release
|
||||
working-directory: .
|
||||
env:
|
||||
INPUT_TAG: ${{ inputs.tag }}
|
||||
run: |
|
||||
if [[ "$GITHUB_EVENT_NAME" == 'workflow_dispatch' ]]; then
|
||||
tag=$INPUT_TAG
|
||||
else
|
||||
tag=$GITHUB_REF_NAME
|
||||
fi
|
||||
version='v[0-9]+\.[0-9]+\.[0-9]+'
|
||||
if [[ "$tag" =~ ^$version$ ]]; then
|
||||
registry=ossrh
|
||||
elif [[ "$tag" =~ ^$version-beta\.[0-9]+$ ]]; then
|
||||
registry=fury
|
||||
else
|
||||
echo 'Expected a LanceDB release tag such as v0.42.1 or v0.42.0-beta.38.' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "ref=refs/tags/$tag" >> "$GITHUB_OUTPUT"
|
||||
echo "version=${tag#v}" >> "$GITHUB_OUTPUT"
|
||||
echo "registry=$registry" >> "$GITHUB_OUTPUT"
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
ref: ${{ github.event_name == 'push' && github.sha || steps.release.outputs.ref }}
|
||||
- name: Verify Maven versions match the release tag
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
RELEASE_VERSION: ${{ steps.release.outputs.version }}
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import os
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
ns = {"": "http://maven.apache.org/POM/4.0.0"}
|
||||
expected = os.environ["RELEASE_VERSION"]
|
||||
parent = ET.parse("pom.xml").getroot()
|
||||
core = ET.parse("lancedb-core/pom.xml").getroot()
|
||||
parent_version = parent.findtext("version", namespaces=ns)
|
||||
core_parent_version = core.findtext("parent/version", namespaces=ns)
|
||||
core_version = core.findtext("version", default=core_parent_version, namespaces=ns)
|
||||
if (parent_version, core_parent_version, core_version) != (expected,) * 3:
|
||||
raise SystemExit(f"Both Maven projects must match release version {expected}.")
|
||||
PY
|
||||
- name: Set up Java 8
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
@@ -41,9 +92,9 @@ jobs:
|
||||
cache: "maven"
|
||||
# Betas go to Fury and stable releases to Maven Central, which limits
|
||||
# how many releases an organization may publish each month.
|
||||
server-id: ${{ contains(github.ref, 'beta') && 'fury' || 'ossrh' }}
|
||||
server-username: ${{ contains(github.ref, 'beta') && 'FURY_TOKEN' || 'SONATYPE_USER' }}
|
||||
server-password: ${{ contains(github.ref, 'beta') && 'FURY_PASSWORD' || 'SONATYPE_TOKEN' }}
|
||||
server-id: ${{ steps.release.outputs.registry == 'fury' && 'fury' || 'ossrh' }}
|
||||
server-username: ${{ steps.release.outputs.registry == 'fury' && 'FURY_TOKEN' || 'SONATYPE_USER' }}
|
||||
server-password: ${{ steps.release.outputs.registry == 'fury' && 'FURY_PASSWORD' || 'SONATYPE_TOKEN' }}
|
||||
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
||||
- name: Set git config
|
||||
@@ -55,7 +106,7 @@ jobs:
|
||||
run: |
|
||||
./mvnw --batch-mode -DskipTests package -pl lancedb-core -am
|
||||
- name: Publish to Fury
|
||||
if: startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'beta')
|
||||
if: steps.release.outputs.registry == 'fury'
|
||||
run: |
|
||||
./mvnw --batch-mode -DskipTests deploy -pl lancedb-core -am -P deploy-to-fury
|
||||
env:
|
||||
@@ -63,7 +114,7 @@ jobs:
|
||||
# Fury authenticates with the token as the username; the password is ignored.
|
||||
FURY_PASSWORD: NOPASS
|
||||
- name: Publish to Maven Central
|
||||
if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'beta')
|
||||
if: steps.release.outputs.registry == 'ossrh'
|
||||
run: |
|
||||
echo "use-agent" >> ~/.gnupg/gpg.conf
|
||||
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
|
||||
@@ -78,7 +129,7 @@ jobs:
|
||||
name: Report Workflow Failure
|
||||
runs-on: ubuntu-latest
|
||||
needs: [publish]
|
||||
if: always() && failure() && startsWith(github.ref, 'refs/tags/v')
|
||||
if: always() && failure() && github.event_name == 'push'
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
@@ -138,6 +138,17 @@ Select `bump-minor` according to the version and breaking-change check below.
|
||||
> is needed and fail the `Create Release Commit` job. To fix, select the
|
||||
> "bump minor version" option.
|
||||
|
||||
### Retrying Java publication
|
||||
|
||||
If the original Java publishing workflow can no longer be rerun, dispatch it
|
||||
from `main` with the existing release tag. The workflow checks out that tag,
|
||||
verifies the Maven versions, and uses the same destination and signing steps
|
||||
as a tag-triggered run. Check the destination for the version before retrying.
|
||||
|
||||
```bash
|
||||
gh workflow run java-publish.yml --repo lancedb/lancedb --ref main -f tag=v0.42.1
|
||||
```
|
||||
|
||||
### CLI release packages
|
||||
|
||||
The GitHub Release workflow calls **CLI release packages** before creating the
|
||||
|
||||
Reference in New Issue
Block a user