This is an automated email from the ASF dual-hosted git repository.
janardhan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new 0c3c3c297d [SYSTEMDS-3480] Verify release scripts with github workflows
0c3c3c297d is described below
commit 0c3c3c297d083efa4899de6533b3e36f854ce99f
Author: Janardhan Pulivarthi <[email protected]>
AuthorDate: Sun Dec 18 00:14:19 2022 +0530
[SYSTEMDS-3480] Verify release scripts with github workflows
- Confidence check that the shell scripts used for release, won't break.
- maven release related plugins work as intended.
Closes #1753.
---
.github/workflows/release-scripts.yml | 124 ++++++++++++++++++++++++++++++++++
dev/release/do-release.sh | 36 +++++++++-
dev/release/release-utils.sh | 3 +
3 files changed, 160 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/release-scripts.yml
b/.github/workflows/release-scripts.yml
new file mode 100644
index 0000000000..a7976ab355
--- /dev/null
+++ b/.github/workflows/release-scripts.yml
@@ -0,0 +1,124 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+# This workflow will build a package using Maven and then publish it to GitHub
packages when a release is created
+# For more information see:
https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
+
+name: Test Release scripts with dry run
+
+on:
+ push:
+ release:
+ types: [created]
+
+ workflow_dispatch:
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+
+ steps:
+ # Java setup docs:
+ #
https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#installing-custom-java-package-type
+ - uses: actions/checkout@v2
+ - name: Set up JDK 11
+ uses: actions/setup-java@v2
+ with:
+ # tools.jar removed from '9', '11'. see
https://openjdk.java.net/jeps/220
+ java-version: '11'
+ distribution: 'adopt'
+ java-package: 'jdk'
+
+ - run: printf "JAVA_HOME = $JAVA_HOME \n"
+
+ - name: Cache local Maven repository
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+
+ - name: gpg key generation - transient
+ run: |
+ printf "HOME: $HOME \n"
+ ls $HOME
+ export GNUPGHOME="$HOME/.gnupg"
+ ls *
+ cat >tempkey <<EOF
+ %echo Generating a basic OpenPGP key
+ Key-Type: DSA
+ Key-Length: 1024
+ Subkey-Type: ELG-E
+ Subkey-Length: 1024
+ Name-Real: J143 Bot
+ Name-Comment: This is automation script
+ Name-Email: j143+[bot]@protonmail.com
+ Expire-Date: 0
+ Passphrase: asdfghjkl
+ # Do a commit here, so that we can later print "done" :-)
+ %commit
+ %echo done
+ EOF
+ gpg --batch --generate-key tempkey
+ sudo cp -rp $HOME/.gnupg $HOME/gnupghome
+ ls $HOME/gnupghome
+
+ # the last eight digits of the finger print is key id
+ - name: Set the GPG key ID
+ run: |
+ gpg --list-keys
+ GPG_KEY_FINGERPRINT="$(gpg --list-keys | head -n 4 | tail -n 1 | sed
's/^ *//g')"
+ GPG_KEY_ID="${GPG_KEY_FINGERPRINT: (-8)}"
+
+ - name: Run invoke script
+ run: |
+ cd $GITHUB_WORKSPACE
+ printf "$GITHUB_WORKSPACE --> github workspace\n"
+ export GNUPGHOME="$HOME/gnupghome"
+ gpgconf --kill gpg-agent
+ ls $GNUPGHOME
+ GPG_KEY_FINGERPRINT="$(gpg --list-keys | head -n 4 | tail -n 1 | sed
's/^ *//g')"
+ GPG_KEY_ID="${GPG_KEY_FINGERPRINT: (-8)}"
+ export GPG_KEY=$GPG_KEY_ID
+ bash $GITHUB_WORKSPACE/dev/release/do-release.sh -n -g
+ env:
+ DRY_RUN: '1'
+ GIT_BRANCH: 'main'
+ RELEASE_VERSION: '3.0.0'
+ ASF_USERNAME: 'firstname'
+ GIT_NAME: 'Firstname Lastname'
+ GIT_EMAIL: 'j143+[bot]@protonmail.com'
+ CORRECT_RELEASE_INFO: '1'
+ ASF_PASSWORD: 'asdfghjkl' # wrong password, only to run this workflow
+ GPG_PASSPHRASE: 'asdfghjkl' # wrong passphrase, only to run this
workflow
+
+# - name: Build with Maven
+# run: mvn -B package --file pom.xml
+
+# - name: Publish to GitHub Packages Apache Maven
+# run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
+# env:
+# GITHUB_TOKEN: ${{ github.token }}
diff --git a/dev/release/do-release.sh b/dev/release/do-release.sh
index 36ab60a883..41d50a16d7 100755
--- a/dev/release/do-release.sh
+++ b/dev/release/do-release.sh
@@ -30,24 +30,32 @@ SELF=$(cd $(dirname $0) && pwd)
# discussion on optional arguments
# https://stackoverflow.com/q/18414054
-while getopts ":n" opt; do
+while getopts ":ng" opt; do
case $opt in
n) DRY_RUN=1 ;;
+ g) GITHUB_CI=1 ;;
\?) error "Invalid option: $OPTARG" ;;
esac
done
DRY_RUN=${DRY_RUN:-0}
+GITHUB_CI=${GITHUB_CI:-0}
cleanup_repo
# Ask for release information
get_release_info
+if is_github_ci; then
+ printf "\n Building via GITHUB actions \n"
+fi
+
# tag
run_silent "Creating release tag $RELEASE_TAG..." "tag.log" \
"$SELF/create-tag.sh"
+cat tag.log
+
# run_silent "Publish Release Candidates to the Nexus Repo..."
"publish-snapshot.log" \
# "$SELF/release-build.sh" publish-snapshot
@@ -63,10 +71,32 @@ fi
#
# are to be used together.
-run_silent "Publish Release Candidates to the Nexus Repo..." "publish.log" \
- "$SELF/release-build.sh" publish-release
+if ! is_github_ci; then
+ run_silent "Publish Release Candidates to the Nexus Repo..." "publish.log" \
+ "$SELF/release-build.sh" publish-release
+fi
if is_dry_run; then
# restore the pom.xml file updated during release step
git restore pom.xml
fi
+
+if is_github_ci; then
+ printf "\n Release tag process is done via GITHUB actions \n"
+ exit 0
+fi
+
+if ! is_dry_run; then
+
+ printf "\n Release candidate artifacts are built and published to
repository.apache.org, dist.apache.org \n"
+ printf "\n Voting needs to be done for these artifacts for via the mailing
list \n"
+ exit 0
+fi
+
+# Dry run step
+if is_dry_run; then
+
+ printf "\n Release candidate artifacts are built and published to
repository.apache.org, dist.apache.org \n"
+ printf "\n Please delete these artifacts generated with dry run to ensure
that the release scripts are generating correct artifacts. \n"
+ exit 0
+fi
diff --git a/dev/release/release-utils.sh b/dev/release/release-utils.sh
index 9c31bb188b..13a09b5f58 100755
--- a/dev/release/release-utils.sh
+++ b/dev/release/release-utils.sh
@@ -276,3 +276,6 @@ is_dry_run() {
[[ "$DRY_RUN" = 1 ]]
}
+is_github_ci() {
+ [[ "$GITHUB_CI" = 1 ]]
+}
\ No newline at end of file