From 70b6351523a24eecb1ffe83653682976bae2fb4b Mon Sep 17 00:00:00 2001 From: Nicholas Walter Knize Date: Thu, 15 Feb 2024 16:32:05 -0600 Subject: [PATCH] add lucene snapshot workflow Workflow to build lucene snapshots and publish them to github packages. Signed-off-by: Nicholas Walter Knize --- .github/workflows/lucene-snapshots.yml | 68 ++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/lucene-snapshots.yml diff --git a/.github/workflows/lucene-snapshots.yml b/.github/workflows/lucene-snapshots.yml new file mode 100644 index 0000000..ce424f2 --- /dev/null +++ b/.github/workflows/lucene-snapshots.yml @@ -0,0 +1,68 @@ +# This workflow will check out, build, and publish snapshots of lucene. + +name: Lucene snapshots + +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + ref: + description: + required: false + default: 'main' + +jobs: + publish-snapshots: + if: github.repository == 'lucenia/snapshots' + runs-on: ubuntu-latest + # These permissions are needed to interact with GitHub's OIDC Token endpoint. + permissions: + id-token: write + contents: read + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + - name: Checkout Lucene + uses: actions/checkout@v4 + with: + repository: 'apache/lucene' + path: lucene + ref: ${{ github.event.inputs.ref }} + + - name: Set hash + working-directory: ./lucene + run: | + echo "REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + id: version + + - name: Initialize gradle settings + working-directory: ./lucene + run: ./gradlew localSettings + + - name: Publish Lucene to local maven repo. + working-directory: ./lucene + run: ./gradlew publishJarsPublicationToMavenLocal -Pversion.suffix=snapshot-${{ steps.version.outputs.REVISION }} + + - name: Checkout build repo + uses: actions/checkout@v4 + with: + repository: lucenia/build + ref: main + path: lucenia-build + + - name: Copy settings.xml + run: | + cp lucenia-build/maven/settings.xml ~/.m2/ + + - name: Publish lucene snapshot to github packages + env: + USERNAME: ${{github.actor}} + ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + bash lucenia-build/scripts/gradle/publish-to-github-packages.sh ~/.m2/repository/ lucenia-bot snapshots github