Skip to content
Open
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
74 changes: 74 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish

on:
release:
types: [created]
workflow_dispatch:
inputs:
resume_from:
description: 'Resume the reactor from this project (maven -rf, e.g. :spark-sql_2.13). Leave empty to build all.'
required: false
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

permissions:
contents: read
packages: write

env:
JAVA_VERSION: '17'
MAVEN_ARGS: -B -V -e -ntp
MAVEN_OPTS: -Xmx4g -XX:ReservedCodeCacheSize=1g -XX:MaxMetaspaceSize=2g
SPARK_PROFILES: -Pscala-2.13 -Phadoop-3 -Phive -Phive-thriftserver -Pyarn -Pkubernetes -Phadoop-cloud -Pconnect -Pvolcano
# -rf <project> when a resume point is given on manual dispatch, otherwise empty.
RESUME_ARG: ${{ inputs.resume_from != '' && format('-rf {0}', inputs.resume_from) || '' }}

jobs:
publish:
name: "Publish to GitHub Packages (arenadata)"
runs-on: ubuntu-24.04
timeout-minutes: 120
steps:
- uses: actions/checkout@v6

- uses: actions/setup-java@v5
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: temurin
cache: maven
# server-id must match the <distributionManagement> repository id in pom.xml
server-id: github
server-username: GITHUB_ACTOR
server-password: GITHUB_TOKEN

- name: Verify release tag matches pom version
if: github.event_name == 'release'
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
POM_VERSION="$(./build/mvn -q -N help:evaluate -Dexpression=project.version -DforceStdout)"
TAG_VERSION="${GITHUB_REF_NAME#v}"
echo "pom version: '$POM_VERSION'"
echo "tag version: '$TAG_VERSION'"
if [[ "$POM_VERSION" != "$TAG_VERSION" ]]; then
echo "::error::Release tag ('$TAG_VERSION') does not match pom version ('$POM_VERSION'). Aborting publish."
exit 1
fi

# deployAtEnd builds the whole reactor first and defers all uploads until
# every module has built successfully, so a failure mid-reactor does not
# leave a partial release. GitHub Packages does not allow re-publishing an
# existing version, so this all-or-nothing behavior is what we want.
- name: Build and deploy artifacts
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
./build/mvn ${{ env.MAVEN_ARGS }} deploy
-DskipTests -DdeployAtEnd=true
${{ env.SPARK_PROFILES }}
${{ env.RESUME_ARG }}
Loading