|
| 1 | +name: Maven RC release |
| 2 | + |
| 3 | +# RCs are published to GitHub Packages while Maven Central Publisher Pro is being arranged. |
| 4 | +# The permanent Maven coordinates are used from the first RC, so the later Central migration |
| 5 | +# changes only the repository URL, not users' dependencies. |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: |
| 9 | + - 'v*-rc.*' |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + tag: |
| 13 | + description: Existing RC tag to build and publish |
| 14 | + required: true |
| 15 | + type: string |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: rc-release-${{ inputs.tag || github.ref_name }} |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: read |
| 23 | + actions: read |
| 24 | + |
| 25 | +env: |
| 26 | + MAVEN_ARGS: '--batch-mode --no-transfer-progress' |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + name: build ${{ matrix.platform }} |
| 31 | + runs-on: ${{ matrix.runner }} |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + matrix: |
| 35 | + include: |
| 36 | + - platform: linux-x86_64-gnu |
| 37 | + runner: ubuntu-22.04 |
| 38 | + - platform: linux-aarch64-gnu |
| 39 | + runner: ubuntu-22.04-arm |
| 40 | + - platform: macos-aarch64 |
| 41 | + runner: macos-15 |
| 42 | + - platform: macos-x86_64 |
| 43 | + runner: macos-15-intel |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + with: |
| 47 | + ref: ${{ inputs.tag || github.ref }} |
| 48 | + |
| 49 | + - uses: actions/setup-java@v4 |
| 50 | + with: |
| 51 | + distribution: temurin |
| 52 | + java-version: '11' |
| 53 | + cache: maven |
| 54 | + |
| 55 | + - name: Resolve and validate RC version |
| 56 | + run: | |
| 57 | + set -eu |
| 58 | + TAG='${{ inputs.tag || github.ref_name }}' |
| 59 | + case "$TAG" in |
| 60 | + v*-rc.*) ;; |
| 61 | + *) echo "Expected a tag like v1.0.0-rc.1, got $TAG" >&2; exit 1 ;; |
| 62 | + esac |
| 63 | + VERSION="${TAG#v}" |
| 64 | + echo "RC_TAG=$TAG" >> "$GITHUB_ENV" |
| 65 | + echo "RC_VERSION=$VERSION" >> "$GITHUB_ENV" |
| 66 | +
|
| 67 | + - name: Set the Maven RC version |
| 68 | + run: | |
| 69 | + # shellcheck disable=SC2086 |
| 70 | + mvn $MAVEN_ARGS org.codehaus.mojo:versions-maven-plugin:2.17.0:set \ |
| 71 | + -DnewVersion="$RC_VERSION" -DgenerateBackupPoms=false |
| 72 | +
|
| 73 | + - name: Compile and run unit tests |
| 74 | + run: | |
| 75 | + # shellcheck disable=SC2086 |
| 76 | + mvn $MAVEN_ARGS -pl chdb-jdbc -am test |
| 77 | +
|
| 78 | + - name: Fetch the engine and build the native shim |
| 79 | + run: | |
| 80 | + case '${{ matrix.platform }}' in |
| 81 | + linux-*) scripts/build-native-in-container.sh '${{ matrix.platform }}' ;; |
| 82 | + *) scripts/build-native.sh '${{ matrix.platform }}' ;; |
| 83 | + esac |
| 84 | +
|
| 85 | + - name: Package the JDBC and native artifacts |
| 86 | + run: | |
| 87 | + set -eu |
| 88 | + # shellcheck disable=SC2086 |
| 89 | + mvn $MAVEN_ARGS -pl chdb-jdbc,chdb-native-${{ matrix.platform }} package -DskipTests |
| 90 | + mkdir -p "maven/${{ matrix.platform }}" |
| 91 | + cp "chdb-jdbc/target/chdb-jdbc-${RC_VERSION}.jar" "maven/${{ matrix.platform }}/" |
| 92 | + cp "chdb-native-${{ matrix.platform }}/target/chdb-native-${{ matrix.platform }}-${RC_VERSION}.jar" "maven/${{ matrix.platform }}/" |
| 93 | + cp pom.xml "maven/${{ matrix.platform }}/chdb-java-parent.pom" |
| 94 | + cp chdb-jdbc/pom.xml "maven/${{ matrix.platform }}/chdb-jdbc.pom" |
| 95 | + cp "chdb-native-${{ matrix.platform }}/pom.xml" "maven/${{ matrix.platform }}/chdb-native-${{ matrix.platform }}.pom" |
| 96 | + cp chdb-bom/pom.xml "maven/${{ matrix.platform }}/chdb-bom.pom" |
| 97 | +
|
| 98 | + - uses: actions/upload-artifact@v4 |
| 99 | + with: |
| 100 | + name: maven-${{ matrix.platform }} |
| 101 | + path: maven/${{ matrix.platform }} |
| 102 | + if-no-files-found: error |
| 103 | + retention-days: 14 |
| 104 | + |
| 105 | + publish: |
| 106 | + name: publish RC to GitHub Packages |
| 107 | + needs: build |
| 108 | + runs-on: ubuntu-latest |
| 109 | + permissions: |
| 110 | + contents: read |
| 111 | + packages: write |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@v4 |
| 114 | + with: |
| 115 | + ref: ${{ inputs.tag || github.ref }} |
| 116 | + |
| 117 | + - uses: actions/setup-java@v4 |
| 118 | + with: |
| 119 | + distribution: temurin |
| 120 | + java-version: '11' |
| 121 | + server-id: github |
| 122 | + server-username: GITHUB_ACTOR |
| 123 | + server-password: GITHUB_TOKEN |
| 124 | + |
| 125 | + - name: Resolve RC version |
| 126 | + run: | |
| 127 | + TAG='${{ inputs.tag || github.ref_name }}' |
| 128 | + case "$TAG" in |
| 129 | + v*-rc.*) ;; |
| 130 | + *) echo "Expected a tag like v1.0.0-rc.1, got $TAG" >&2; exit 1 ;; |
| 131 | + esac |
| 132 | + echo "RC_VERSION=${TAG#v}" >> "$GITHUB_ENV" |
| 133 | +
|
| 134 | + - uses: actions/download-artifact@v4 |
| 135 | + with: |
| 136 | + pattern: maven-* |
| 137 | + path: maven |
| 138 | + |
| 139 | + - name: Publish Maven artifacts |
| 140 | + env: |
| 141 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + GITHUB_ACTOR: ${{ github.actor }} |
| 143 | + run: | |
| 144 | + set -eu |
| 145 | + REPOSITORY_URL="https://maven.pkg.github.com/${GITHUB_REPOSITORY_OWNER,,}/chdb-java" |
| 146 | + PARENT_POM=$(find maven -name chdb-java-parent.pom -print -quit) |
| 147 | + JDBC_POM=$(find maven -name chdb-jdbc.pom -print -quit) |
| 148 | + BOM_POM=$(find maven -name chdb-bom.pom -print -quit) |
| 149 | +
|
| 150 | + mvn $MAVEN_ARGS org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file \ |
| 151 | + -Dfile="$PARENT_POM" -DgroupId=com.clickhouse.chdb -DartifactId=chdb-java-parent \ |
| 152 | + -Dversion="$RC_VERSION" -Dpackaging=pom -DgeneratePom=false \ |
| 153 | + -DrepositoryId=github -Durl="$REPOSITORY_URL" |
| 154 | +
|
| 155 | + mvn $MAVEN_ARGS org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file \ |
| 156 | + -Dfile="$(find maven -name "chdb-jdbc-${RC_VERSION}.jar" -print -quit)" \ |
| 157 | + -DpomFile="$JDBC_POM" -DgeneratePom=false \ |
| 158 | + -DrepositoryId=github -Durl="$REPOSITORY_URL" |
| 159 | +
|
| 160 | + for platform in macos-aarch64 macos-x86_64 linux-x86_64-gnu linux-aarch64-gnu; do |
| 161 | + NATIVE_POM=$(find maven -name "chdb-native-${platform}.pom" -print -quit) |
| 162 | + NATIVE_JAR=$(find maven -name "chdb-native-${platform}-${RC_VERSION}.jar" -print -quit) |
| 163 | + mvn $MAVEN_ARGS org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file \ |
| 164 | + -Dfile="$NATIVE_JAR" -DpomFile="$NATIVE_POM" -DgeneratePom=false \ |
| 165 | + -DrepositoryId=github -Durl="$REPOSITORY_URL" |
| 166 | + done |
| 167 | +
|
| 168 | + mvn $MAVEN_ARGS org.apache.maven.plugins:maven-deploy-plugin:3.1.3:deploy-file \ |
| 169 | + -Dfile="$BOM_POM" -DpomFile="$BOM_POM" -Dpackaging=pom \ |
| 170 | + -DgroupId=com.clickhouse.chdb -DartifactId=chdb-bom -Dversion="$RC_VERSION" \ |
| 171 | + -DgeneratePom=false \ |
| 172 | + -DrepositoryId=github -Durl="$REPOSITORY_URL" |
0 commit comments