Skip to content

Commit 931066f

Browse files
jDramaixcopybara-github
authored andcommitted
Fix release automation workflows
- Fixes the reusable workflows link to point to master branch and fix typo in the file name. - With workflow_dispatch triggering, boolean inputs are represented as string even if typed as boolean. We need to convert them to real boolean when passing the input to the reusable workflow. - Removes the read password prompt which breaks when running non-interactively in the workflow. - Github action environment uses jar version 21 that does not accept -C option with extract mode. So we now create a subshell in order to cd into the right directory before extracting the jar. PiperOrigin-RevId: 783404964
1 parent c736851 commit 931066f

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

.github/workflows/release.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ on:
3636

3737
jobs:
3838
release:
39-
uses: google/j2cl/.github/workflows/release-common.yaml@main
39+
uses: google/j2cl/.github/workflows/release_common.yaml@master
4040

4141
# The reusable workflow requires 'write' access to contents to push a git tag.
4242
permissions:
@@ -45,8 +45,8 @@ jobs:
4545
# Pass the inputs from the manual trigger to the reusable workflow.
4646
with:
4747
version: ${{ github.event.inputs.version }}
48-
sonatype_auto_publish: ${{ github.event.inputs.sonatype_auto_publish }}
49-
create_tag: ${{ github.event.inputs.create_tag }}
48+
sonatype_auto_publish: ${{ github.event.inputs.sonatype_auto_publish == 'true' }}
49+
create_tag: ${{ github.event.inputs.create_tag == 'true' }}
5050

5151
# Allow the reusable workflow to access the secrets.
5252
secrets: inherit

maven/deploy.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@ common::check_bazel_prerequisites() {
9393
# - MAVEN_ARTIFACT is set.
9494
# - a pom xml file is present in the maven directory
9595
# - global variables used for deployement are set.
96-
# - check if MAVEN_GPG_PASSPHRASE env var is set. If not ask the user to provide
97-
#. it and store the passphrase in MAVEN_GPG_PASSPHRASE.
9896
# Globals:
9997
# MAVEN_ARTIFACT
10098
# BAZEL_ROOT
101-
# MAVEN_GPG_PASSPHRASE
10299
#######################################
103100
common::check_maven_prerequisites() {
104101
if ! command -v mvn &> /dev/null; then
@@ -125,12 +122,6 @@ common::check_maven_prerequisites() {
125122
if [[ -z "${sonatype_auto_publish:-}" ]]; then
126123
common::error "sonatype_auto_publish variable is missing."
127124
fi
128-
129-
if [[ -z ${MAVEN_GPG_PASSPHRASE:-} ]]; then
130-
# If gpg_passphrase is unset, ask the user to provide it.
131-
echo "Enter your gpg passphrase:"
132-
read -s MAVEN_GPG_PASSPHRASE
133-
fi
134125
}
135126

136127
#######################################
@@ -166,7 +157,7 @@ common::_prepare_sources_artifact() {
166157
common::info "Adding license header to java source files."
167158

168159
local srcs_directory=$(mktemp -d)
169-
jar xf "${bazel_src_jar}" -C "${srcs_directory}"
160+
(cd "${srcs_directory}" && jar xf "${bazel_src_jar}")
170161

171162
local tmp_file=$(mktemp)
172163

@@ -199,11 +190,11 @@ common::_extract_classes(){
199190

200191
local bazel_jar_file="${BAZEL_ROOT}/bazel-bin/${BAZEL_PATH}/lib${BAZEL_ARTIFACT}.jar"
201192

202-
jar xf "${bazel_jar_file}" -C "${classes_directory}"
193+
(cd "${classes_directory}" && jar xf "${bazel_jar_file}")
203194

204195
if [[ "${COPY_SRCS_IN_JAR:-true}" == true ]]; then
205196
common::info "Extracting sources along with the class files."
206-
jar xf "${maven_src_jar}" -C "${classes_directory}"
197+
(cd "${classes_directory}" && jar xf "${maven_src_jar}")
207198
fi
208199
}
209200

0 commit comments

Comments
 (0)