You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2022/04/29 11:18:44 UTC

[maven-mvnd] branch master updated: Add a publish phase

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git


The following commit(s) were added to refs/heads/master by this push:
     new c4d5f24  Add a publish phase
c4d5f24 is described below

commit c4d5f24fd3e6f8bc01ae676b8f14679e4635bc50
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Apr 29 13:18:29 2022 +0200

    Add a publish phase
---
 build/publish.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 build/release.sh | 32 +++++++++++++++++++++++++++-----
 2 files changed, 83 insertions(+), 5 deletions(-)

diff --git a/build/publish.sh b/build/publish.sh
new file mode 100644
index 0000000..8692015
--- /dev/null
+++ b/build/publish.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+#
+# Copyright 2022 the original author or authors.
+#
+# Licensed 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
+set -x
+export VERSION=$1
+
+if [ "${VERSION}x" = "x" ]
+then
+  echo "Specify the version: $0 [version]"
+  exit 1
+fi
+
+rm -Rf target/releases/${VERSION}
+mkdir -p target/releases/${VERSION}
+pushd target/releases
+
+runsUrl=$(echo "https://api.github.com/repos/apache/maven-mvnd/actions/runs" | sed -e 's?https://api.github.com??g')
+artifactsUrl=$(gh api -H "Accept: application/vnd.github.v3+json" $runsUrl --jq '.workflow_runs[] | select(.name=="Release" and .head_branch=="'${VERSION}'") | .artifacts_url' | sed -e 's?https://api.github.com??g')
+downloadUrl=$(gh api -H "Accept: application/vnd.github.v3+json" $artifactsUrl --jq '.artifacts[] | select(.name = "artifacts") | .archive_download_url' | sed -e 's?https://api.github.com??g')
+echo "Downloading artifacts from $downloadUrl"
+gh api $downloadUrl > artifacts-${VERSION}.zip
+unzip artifacts-${VERSION}.zip -d ${VERSION}
+cd ${VERSION}
+
+for dist in darwin-amd64.zip linux-amd64.zip windows-amd64.zip src.zip src.tar.gz
+do
+  FILE=mvnd-${VERSION}-${dist}
+  echo "$(cat ${FILE}.sha256) ${FILE}" | shasum -c
+  md5 -q ${FILE} > ${FILE}.md5
+  shasum -a 1 -b ${FILE} | cut -d ' ' -f 1 > ${FILE}.sha1
+  shasum -a 512 -b ${FILE} | cut -d ' ' -f 1 > ${FILE}.sha512
+  gpg --detach-sign --armor ${FILE}
+done
+
+svn co https://dist.apache.org/repos/dist/dev/maven/mvnd
+mv ${VERSION} mvnd
+cd mvnd
+svn add ${VERSION}
+svn commit -m "Release Apache Maven Daemon ${VERSION}"
+
+popd
diff --git a/build/release.sh b/build/release.sh
index 8902da7..5201186 100755
--- a/build/release.sh
+++ b/build/release.sh
@@ -17,24 +17,46 @@
 
 
 set -e
-set -x
 export VERSION=$1
 export NEXT_VERSION=$2
 
+if [ "${VERSION}x" = "x" ] || [ "${NEXT_VERSION}x" = "x" ]
+then
+  echo "Specify the version: $0 [version] [next-version]"
+  exit 1
+fi
+
+# checkout
 git checkout master
-git fetch upstream
-git reset --hard upstream/master
+git fetch origin
+git reset --hard origin/master
+
+# update version
 mvn versions:set -DnewVersion=$VERSION
+
+# udpate changelog
 docker run -it --rm -v "$(pwd)":/usr/local/src/your-app githubchangeloggenerator/github-changelog-generator \
     --user apache --project maven-mvnd --token GITHUB_TOKEN
+
+# rebuild native libraries
+pushd native
+make native-all
+popd
+
+# commit
 git add -A
 git commit -m "[release] Release $VERSION"
+
+# Create and push tag
 git tag $VERSION
-git push upstream $VERSION
+git push origin $VERSION
 # Pushing a tag will trigger the CI to build the release and publish
 # the artifacts on https://github.com/apache/maven-mvnd/releases
 
+# update version
 mvn versions:set -DnewVersion=$NEXT_VERSION
+
+# commit
 git add -A
 git commit -m "Next is $NEXT_VERSION"
-git push upstream master
+git push origin master