|
4 | 4 | # SPDX-License-Identifier: Apache-2.0
|
5 | 5 |
|
6 | 6 | # --- Configuration ---
|
7 |
| -RELEASE_SERIES="$1" # e.g., v0.85.x |
8 |
| -PREPARE_RELEASE_COMMIT_HASH="$2" # Optional: Specific commit hash for "Prepare release" |
9 | 7 | UPSTREAM_REMOTE_NAME=${UPSTREAM_REMOTE_NAME:-"upstream"} # Your upstream remote name for open-telemetry/opentelemetry-collector
|
10 | 8 | MAIN_BRANCH_NAME=${MAIN_BRANCH_NAME:-"main"}
|
11 | 9 | LOCAL_MAIN_BRANCH_NAME=${LOCAL_MAIN_BRANCH_NAME:-"${MAIN_BRANCH_NAME}"}
|
12 | 10 | # These variables are only used if git user.name and git user.email are not configured
|
13 | 11 | GIT_CONFIG_USER_NAME=${GIT_CONFIG_USER_NAME:-"opentelemetrybot"}
|
14 | 12 | GIT_CONFIG_USER_EMAIL= ${GIT_CONFIG_USER_EMAIL:-"[email protected]"}
|
15 | 13 |
|
16 |
| -# --- Validate Input --- |
17 |
| -if [[ -z "$RELEASE_SERIES" || -z "$PREPARE_RELEASE_COMMIT_HASH" ]]; then |
18 |
| - echo "Error: Both release series and prepare release commit hash must be provided." |
19 |
| - echo "Usage: $0 <release-series> <prepare-release-commit-hash>" |
20 |
| - echo "Example: $0 v0.85.x a1b2c3d4" |
| 14 | +# --- Extract release information from tag --- |
| 15 | +if [[ -z "$GITHUB_REF" ]]; then |
| 16 | + echo "Error: GITHUB_REF environment variable must be provided when running in GitHub Actions." |
| 17 | + echo "For manual usage: GITHUB_REF=refs/tags/v0.85.0 $0" |
21 | 18 | exit 1
|
22 | 19 | fi
|
23 | 20 |
|
| 21 | +# Extract tag name and validate format using regex |
| 22 | +if [[ ! $GITHUB_REF =~ ^refs/tags/v([0-9]+\.[0-9]+)\.[0-9]+(-.+)?$ ]]; then |
| 23 | + echo "Error: GITHUB_REF did not match expected format (refs/tags/vX.XX.X)" |
| 24 | + exit 1 |
| 25 | +fi |
| 26 | + |
| 27 | +# Extract version numbers from regex match |
| 28 | +VERSION_MAJOR_MINOR=${BASH_REMATCH[1]} |
| 29 | +RELEASE_SERIES="v${VERSION_MAJOR_MINOR}.x" |
| 30 | +echo "Release series: ${RELEASE_SERIES}" |
| 31 | + |
| 32 | +# --- Use current commit as prepare release commit --- |
| 33 | +PREPARE_RELEASE_COMMIT_HASH="${GITHUB_SHA:-HEAD}" |
| 34 | +echo "Using current commit as prepare release commit: ${PREPARE_RELEASE_COMMIT_HASH}" |
| 35 | + |
24 | 36 | RELEASE_BRANCH_NAME="release/${RELEASE_SERIES}"
|
25 | 37 |
|
26 | 38 | echo "Automating Release Steps for: ${RELEASE_SERIES}"
|
@@ -78,6 +90,6 @@ echo "Step 4 completed."
|
78 | 90 | echo "--------------------------------------------------"
|
79 | 91 |
|
80 | 92 | echo ""
|
81 |
| -echo "Automation for your Step 4 (push release/<release-series> branch) complete." |
82 |
| -echo "Next, you would typically proceed to your Step 5 on your local machine." |
83 |
| -echo "You will need to check out the release branch locally and push beta/stable tags." |
| 93 | +echo "Automation for release branch creation complete." |
| 94 | +echo "Release branch '${RELEASE_BRANCH_NAME}' has been created from the prepare release commit." |
| 95 | +echo "Tag-triggered build workflows should now be running for the pushed tags." |
0 commit comments