Skip to content

chore: Another 0.3.0 release try #26

chore: Another 0.3.0 release try

chore: Another 0.3.0 release try #26

Workflow file for this run

name: Perform release
env:
JAVA_VERSION: 17
on:
pull_request_target:
types:
- closed
branches:
- main
paths:
- .github/project.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
attestations: write
id-token: write
contents: write
discussions: write
issues: write
pull-requests: write
defaults:
run:
shell: bash
jobs:
release:
runs-on: ubuntu-latest
# Verifies that the PR was merged into main, that the PR only runs in the docling-java repo (not a fork), and that the PR branch is NOT from a fork.
if: (github.event.pull_request.merged == true) && (github.repository == 'docling-project/docling-java') && (github.event.pull_request.head.repo.full_name == 'docling-project/docling-java')
steps:
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: app-token
with:
app-id: ${{ vars.DOCLING_JAVA_CI_APP_ID }}
private-key: ${{ secrets.DOCLING_JAVA_CI_PRIVATE_KEY }}
permission-pull-requests: write
permission-contents: write
- name: Checkout before
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ github.event.pull_request.base.sha }}
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Verify only project.yml was changed
id: verify-files
run: |
FILES_CHANGED=$(curl -s -H "Authorization: token ${{ steps.app-token.outputs.token }}" \
"https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | \
jq -r '.[].filename')
if [ "$(echo "$FILES_CHANGED" | wc -l)" -ne 1 ] || [ "$FILES_CHANGED" != ".github/project.yml" ]; then
echo "Warning: Expected only .github/project.yml to be changed, but found:"
echo "$FILES_CHANGED"
echo "Skipping release process."
echo "should_release=false" >> $GITHUB_OUTPUT
else
echo "✓ Verified that only .github/project.yml was changed"
echo "should_release=true" >> $GITHUB_OUTPUT
fi
- name: Capture previous release version
if: steps.verify-files.outputs.should_release == 'true'
run: echo "PREVIOUS_VERSION=$(yq '.release.previous-version' .github/project.yml)" >> $GITHUB_ENV
- name: Capture current version
if: steps.verify-files.outputs.should_release == 'true'
run: echo "CURRENT_VERSION=$(yq '.release.current-version' .github/project.yml)" >> $GITHUB_ENV
- name: Setup Java
if: steps.verify-files.outputs.should_release == 'true'
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: temurin
- name: Setup Gradle
if: steps.verify-files.outputs.should_release == 'true'
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0
- name: Build artifacts
if: steps.verify-files.outputs.should_release == 'true'
run: ./gradlew --no-daemon -Pjava.version=${{ env.JAVA_VERSION }} publish
- name: Release
if: steps.verify-files.outputs.should_release == 'true'
env:
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
JRELEASER_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_DISCORD_WEBHOOK: ${{ secrets.RELEASES_DISCORD_WEBHOOK }}
JRELEASER_DRY_RUN: ${{ inputs.dryrun }}
JRELEASER_TAG_NAME: "v${{ env.CURRENT_VERSION }}"
JRELEASER_PREVIOUS_TAG_NAME: "v${{ env.PREVIOUS_VERSION }}"
run: |
echo "Releasing version ${{ env.PREVIOUS_VERSION }} -> ${{ env.CURRENT_VERSION }}"
./gradlew --no-daemon :jreleaserFullRelease
# Persist logs
- name: JReleaser release output
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: jreleaser-release
path: |
build/jreleaser/trace.log
build/jreleaser/output.properties