Repository navigation
143 lines (125 loc) · 4.82 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (125 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
################################################################################
# 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.
################################################################################
# Orchestrate Java and PyPaimon packaging. Java signing and Nexus staging, plus
# the signed ASF source archives, remain Release Manager responsibilities.
name: Release
on:
push:
tags:
- "release-[0-9]+.[0-9]+.[0-9]+"
- "release-[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"
workflow_dispatch:
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
actions: read
contents: read
jobs:
validation:
name: Validate release tag
runs-on: ubuntu-latest
outputs:
release_version: ${{ steps.release.outputs.release_version }}
release_kind: ${{ steps.release.outputs.release_kind }}
rc_number: ${{ steps.release.outputs.rc_number }}
steps:
- uses: actions/checkout@v6
- name: Set up JDK 8
uses: actions/setup-java@v5
with:
java-version: 8
distribution: temurin
cache: maven
- name: Set up Maven
uses: stCarolas/setup-maven@12eb41b233df95d49b0c11fc1b5bc8312e5d4ce0 # v5.1
with:
maven-version: 3.8.8
- name: Validate tag against project version
id: release
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_REF}" != refs/tags/* ]]; then
echo "Release workflow must run from a tag, got ${GITHUB_REF}" >&2
exit 1
fi
release_version="$(
mvn -q -DforceStdout help:evaluate \
-Dexpression=project.version
)"
if [[ -z "${release_version}" || "${release_version}" == *-SNAPSHOT ]]; then
echo "Project release version is invalid: ${release_version:-missing}" >&2
exit 1
fi
python_release_version="$(
sed -n 's/^VERSION = "\(.*\)"/\1/p' \
paimon-python/pypaimon/_version.py
)"
if [[ "${python_release_version}" != "${release_version}" ]]; then
echo "PyPaimon version ${python_release_version:-missing} does not match Paimon ${release_version}" >&2
exit 1
fi
final_tag="release-${release_version}"
rc_prefix="${final_tag}-rc"
release_kind=""
rc_number=""
if [[ "${GITHUB_REF_NAME}" == "${final_tag}" ]]; then
release_kind="final"
elif [[ "${GITHUB_REF_NAME}" == "${rc_prefix}"* ]]; then
rc_number="${GITHUB_REF_NAME#"${rc_prefix}"}"
if [[ ! "${rc_number}" =~ ^[0-9]+$ ]]; then
echo "RC tag must be ${rc_prefix}N, got ${GITHUB_REF_NAME}" >&2
exit 1
fi
release_kind="rc"
else
echo "Tag must be ${final_tag} or ${rc_prefix}N, got ${GITHUB_REF_NAME}" >&2
exit 1
fi
echo "release_version=${release_version}" >> "${GITHUB_OUTPUT}"
echo "release_kind=${release_kind}" >> "${GITHUB_OUTPUT}"
echo "rc_number=${rc_number}" >> "${GITHUB_OUTPUT}"
echo "Validated ${release_kind} tag ${GITHUB_REF_NAME}"
java -version
mvn -version
java:
name: Java packages
if: >-
startsWith(github.ref, 'refs/tags/') &&
contains(github.ref_name, '-rc')
uses: ./.github/workflows/release-java.yml
python-package:
name: PyPaimon package
needs: validation
uses: ./.github/workflows/release-python.yml
with:
release_version: ${{ needs.validation.outputs.release_version }}
python-publish:
name: PyPaimon publish
needs: [validation, python-package]
if: >-
needs.validation.result == 'success' &&
startsWith(github.ref, 'refs/tags/') &&
needs.python-package.result == 'success'
uses: ./.github/workflows/release-python-publish.yml
with:
release_version: ${{ needs.validation.outputs.release_version }}
secrets:
TEST_PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }}
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}