Skip to content

Commit a7cb882

Browse files
HyukjinKwonyhuang-db
authored andcommitted
[SPARK-52254][INFRA] Adds a GitHub Actions workflow to convert RC to the official release
### What changes were proposed in this pull request? This PR proposes to fix the `release.yml` to actually finalize and convert RC to the official release. ### Why are the changes needed? So we can automate the release processes fully. ### Does this PR introduce _any_ user-facing change? No, dev-only. ### How was this patch tested? Manually in Spark 3.5.6. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#50974 from HyukjinKwon/SPARK-52254. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
1 parent 5f983b0 commit a7cb882

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
# - GPG_PASSPHRASE:
3939
# The passphrase for your GPG private key.
4040
#
41+
# - PYPI_API_TOKEN:
42+
# When you finalize the release, PyPI API token is required. It can be created in
43+
# https://pypi.org/manage/account/ once you have the permission to the projects in:
44+
# - https://pypi.org/project/pyspark/
45+
# - https://pypi.org/project/pyspark-connect/
46+
# - https://pypi.org/project/pyspark-client/
47+
# Ask private@spark.apache.org to have the permission if you do not have.
48+
#
4149
# This workflow supports dry runs by default. If the required GitHub Secrets are not provided,
4250
# only dry runs will be executed.
4351
#
@@ -57,7 +65,7 @@
5765
#
5866
# 4. Drop the staging repository if it exists (https://repository.apache.org/#stagingRepositories)
5967

60-
name: Release Apache Spark (dryrun and RC)
68+
name: Release Apache Spark
6169

6270
on:
6371
schedule:
@@ -70,10 +78,17 @@ on:
7078
release-version:
7179
description: 'Release version. Leave it empty to launch a dryrun.'
7280
required: false
81+
rc-count:
82+
description: 'RC number. Leave it empty to launch a dryrun.'
83+
required: false
84+
finalize:
85+
description: 'Whether to convert RC to the official release (IRREVERSIBLE)'
86+
required: true
87+
default: false
7388

7489
jobs:
7590
release:
76-
name: Release Apache Spark (dryrun and RC)
91+
name: Release Apache Spark
7792
runs-on: ubuntu-latest
7893
# Do not allow dispatching this workflow manually in the main repo.
7994
# and skip this workflow in forked repository when running as a
@@ -85,21 +100,41 @@ jobs:
85100
with:
86101
repository: apache/spark
87102
ref: "${{ inputs.branch }}"
88-
- name: Release Apache Spark (dryrun and RC)
103+
- name: Release Apache Spark
89104
env:
90105
GIT_BRANCH: "${{ inputs.branch }}"
91106
RELEASE_VERSION: "${{ inputs.release-version }}"
107+
SPARK_RC_COUNT: "${{ inputs.rc-count }}"
108+
IS_FINALIZE: "${{ inputs.finalize }}"
92109
GIT_NAME: "${{ github.actor }}"
93110
ASF_USERNAME: "${{ secrets.ASF_USERNAME }}"
94111
ASF_PASSWORD: "${{ secrets.ASF_PASSWORD }}"
95112
GPG_PRIVATE_KEY: "${{ secrets.GPG_PRIVATE_KEY }}"
96113
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
114+
PYPI_API_TOKEN: "${{ secrets.PYPI_API_TOKEN }}"
97115
DEBUG_MODE: 1
98116
ANSWER: y
99117
run: |
118+
if [ "$IS_FINALIZE" = "true" ]; then
119+
echo ""
120+
echo "┌────────────────────────────────────────────────────────────────────────────┐"
121+
echo "│ !!! WARNING !!! │"
122+
echo "├────────────────────────────────────────────────────────────────────────────┤"
123+
echo "│ This step will CONVERT THE RC ARTIFACTS into THE OFFICIAL RELEASE. │"
124+
echo "│ │"
125+
echo "│ This action is IRREVERSIBLE. │"
126+
echo "│ │"
127+
echo "│ The workflow will continue in 60 seconds. │"
128+
echo "│ Cancel this workflow now if you do NOT intend to finalize the release. │"
129+
echo "└────────────────────────────────────────────────────────────────────────────┘"
130+
echo ""
131+
132+
sleep 60
133+
fi
134+
100135
empty_count=0
101136
non_empty_count=0
102-
for val in "$GIT_BRANCH" "$RELEASE_VERSION"; do
137+
for val in "$GIT_BRANCH" "$RELEASE_VERSION" "$SPARK_RC_COUNT"; do
103138
if [ -z "$val" ]; then
104139
empty_count=$((empty_count+1))
105140
else
@@ -112,7 +147,7 @@ jobs:
112147
exit 1
113148
fi
114149
115-
if [ "$empty_count" -eq 2 ]; then
150+
if [ "$empty_count" -eq 3 ]; then
116151
echo "Dry run mode enabled"
117152
export DRYRUN_MODE=1
118153
ASF_PASSWORD="not_used"
@@ -154,6 +189,9 @@ jobs:
154189
if [ "$DRYRUN_MODE" = "1" ]; then
155190
CMD="$CMD -n"
156191
fi
192+
if [ "$IS_FINALIZE" = "true" ]; then
193+
CMD="$CMD -s finalize"
194+
fi
157195
158196
echo "Running release command: $CMD"
159197

0 commit comments

Comments
 (0)