You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2023/06/28 03:19:22 UTC
[incubator-opendal] branch main updated: ci: automatic java binding release (#2557)
This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 960a8de6a ci: automatic java binding release (#2557)
960a8de6a is described below
commit 960a8de6a98f814c6888a4351d63bbe5b323921b
Author: tison <wa...@gmail.com>
AuthorDate: Wed Jun 28 11:19:18 2023 +0800
ci: automatic java binding release (#2557)
Signed-off-by: tison <wa...@gmail.com>
---
.github/workflows/bindings_java.yml | 36 ++++++++++++++---------------------
bindings/java/pom.xml | 2 +-
scripts/merge_local_staging.sh | 38 +++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 23 deletions(-)
diff --git a/.github/workflows/bindings_java.yml b/.github/workflows/bindings_java.yml
index e8279bdbd..40de5cb65 100644
--- a/.github/workflows/bindings_java.yml
+++ b/.github/workflows/bindings_java.yml
@@ -70,9 +70,9 @@ jobs:
working-directory: bindings/java
run: mvn clean verify
- stage-snapshot:
+ stage-releases:
runs-on: ${{ matrix.os }}
- if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
strategy:
matrix:
include:
@@ -107,13 +107,18 @@ jobs:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
+ server-id: apache.releases.https
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Local staging
working-directory: bindings/java
- run: mvn -Papache-release package verify org.sonatype.plugins:nexus-staging-maven-plugin:deploy -Dsuffix.snapshot="-SNAPSHOT" -Djni.classifier=${{ matrix.classifier }} -DskipTests=true -DaltStagingDirectory=local-staging -DskipRemoteStaging=true
+ run: mvn -Papache-release package verify org.sonatype.plugins:nexus-staging-maven-plugin:deploy -Djni.classifier=${{ matrix.classifier }} -DskipTests=true -DaltStagingDirectory=local-staging -DskipRemoteStaging=true -DserverId=apache.releases.https -DnexusUrl=https://repository.apache.org
env:
+ MAVEN_USERNAME: ${{ secrets.NEXUS_USER }}
+ MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PW }}
MAVEN_GPG_PASSPHRASE: ${{ env.MAVEN_GPG_PASSPHRASE }}
- name: Upload local staging directory
@@ -123,10 +128,10 @@ jobs:
path: bindings/java/local-staging
if-no-files-found: error
- deploy-snapshots:
+ deploy-releases:
runs-on: ubuntu-latest
- if: github.event_name == 'push' || !github.event.pull_request.head.repo.fork
- needs: [stage-snapshot]
+ if: ${{ startsWith(github.ref, 'refs/tags/') }}
+ needs: [stage-releases]
steps:
- uses: actions/checkout@v3
- name: Load secret
@@ -145,7 +150,7 @@ jobs:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- server-id: apache.snapshots.https
+ server-id: apache.releases.https
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }}
@@ -177,25 +182,12 @@ jobs:
path: ~/osx-aarch_64-local-staging
- name: Merge staging repositories
- run: |
- mkdir -p ~/local-staging/deferred
-
- # cat ~/windows-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
- # cp -r ~/windows-x86_64-local-staging/deferred/* ~/local-staging/deferred/
-
- cat ~/linux-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
- cp -r ~/linux-x86_64-local-staging/deferred/* ~/local-staging/deferred/
-
- cat ~/osx-x86_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
- cp -r ~/osx-x86_64-local-staging/deferred/* ~/local-staging/deferred/
-
- cat ~/osx-aarch_64-local-staging/deferred/.index >> ~/local-staging/deferred/.index
- cp -r ~/osx-aarch_64-local-staging/deferred/* ~/local-staging/deferred/
+ run: bash ./scripts/merge_local_staging.sh $LOCAL_STAGING_DIR/staging ~/linux-x86_64-local-staging/staging ~/osx-x86_64-local-staging/staging ~/osx-aarch_64-local-staging/staging # ~/windows-x86_64-local-staging/staging
- name: Deploy local staged artifacts
if: ${{ github.event_name != 'pull_request' }}
working-directory: bindings/java
- run: mvn org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -Dsuffix.snapshot="-SNAPSHOT" -DaltStagingDirectory=$LOCAL_STAGING_DIR
+ run: mvn org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DaltStagingDirectory=$LOCAL_STAGING_DIR -DskipStagingRepositoryClose=true -DserverId=apache.releases.https -DnexusUrl=https://repository.apache.org
env:
MAVEN_USERNAME: ${{ secrets.NEXUS_USER }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PW }}
diff --git a/bindings/java/pom.xml b/bindings/java/pom.xml
index 2323ba439..364f55c20 100644
--- a/bindings/java/pom.xml
+++ b/bindings/java/pom.xml
@@ -32,7 +32,7 @@
<groupId>org.apache.opendal</groupId>
<artifactId>opendal-java</artifactId>
- <version>0.38.0${suffix.snapshot}</version>
+ <version>0.38.0</version>
<url>https://opendal.apache.org</url>
<mailingLists>
diff --git a/scripts/merge_local_staging.sh b/scripts/merge_local_staging.sh
new file mode 100644
index 000000000..6e4543823
--- /dev/null
+++ b/scripts/merge_local_staging.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+set -e
+if [ "$#" -lt 2 ]; then
+ echo "Expected target directory and at least one local staging directory"
+ exit 1
+fi
+TARGET=$1
+
+for ((i=2; i<=$#; i++))
+do
+ DIR="${!i}"
+ SUB_DIR=$(ls -d "${DIR}"/* | awk -F / '{print $NF}')
+
+ if [ ! -d "${TARGET}/${SUB_DIR}" ]
+ then
+ mkdir -p "${TARGET}/${SUB_DIR}"
+ fi
+ cat "${DIR}"/"${SUB_DIR}"/.index >> "${TARGET}/${SUB_DIR}"/.index
+ cp -r "${DIR}"/"${SUB_DIR}"/* "${TARGET}/${SUB_DIR}"/
+done