Skip to content

Commit 290795b

Browse files
Trigger from release branch (#3100)
* run pipeline from release branch to fix provenance * update release instructions * check branch name at validate input step
1 parent ef7a9d3 commit 290795b

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ on:
99
package_name:
1010
description: 'Package folder (Name of the package directory under packages/ folder. e.g., xrpl, ripple-address-codec)'
1111
required: true
12-
release_branch:
13-
description: 'Release branch the release is generated from'
14-
required: true
1512
npmjs_dist_tag:
1613
description: 'npm distribution tag(Read more https://docs.npmjs.com/adding-dist-tags-to-packages)'
1714
default: 'latest'
@@ -30,12 +27,21 @@ jobs:
3027
- name: Checkout code
3128
uses: actions/checkout@v4
3229
with:
33-
ref: ${{ github.event.inputs.release_branch }}
3430
fetch-depth: 0
3531

3632
- name: Validate inputs
3733
run: |
3834
set -euo pipefail
35+
RELEASE_BRANCH="$(git branch --show-current || true)"
36+
if [[ -z "$RELEASE_BRANCH" ]]; then
37+
RELEASE_BRANCH="${{ github.ref_name }}"
38+
fi
39+
40+
if [[ -z "$RELEASE_BRANCH" ]]; then
41+
echo "❌ Unable to determine branch name." >&2
42+
exit 1
43+
fi
44+
3945
# Validate package_name
4046
PKG_NAME="${{ github.event.inputs.package_name }}"
4147
if ! [[ "$PKG_NAME" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
@@ -47,10 +53,9 @@ jobs:
4753
echo "❌ package_name must be a single directory under packages/." >&2
4854
exit 1
4955
fi
50-
if git ls-remote --exit-code origin "refs/heads/${{ github.event.inputs.release_branch }}" > /dev/null; then
51-
echo "✅ Found release branch: ${{ github.event.inputs.release_branch }}"
52-
else
53-
echo "❌ Release branch ${{ github.event.inputs.release_branch }} not found in remote. Failing workflow."
56+
57+
if [[ ! "${RELEASE_BRANCH,,}" =~ ^release[-/] ]]; then
58+
echo "❌ Release branch '$RELEASE_BRANCH' must start with 'release-' or 'release/'." >&2
5459
exit 1
5560
fi
5661
@@ -115,7 +120,7 @@ jobs:
115120
needs: [get_version]
116121
uses: ./.github/workflows/faucet_test.yml
117122
with:
118-
git_ref: ${{ github.event.inputs.release_branch }}
123+
git_ref: ${{ github.ref }}
119124
secrets: inherit
120125

121126
run_tests:
@@ -127,7 +132,7 @@ jobs:
127132
needs: [get_version]
128133
uses: ./.github/workflows/nodejs.yml
129134
with:
130-
git_ref: ${{ github.event.inputs.release_branch }}
135+
git_ref: ${{ github.ref }}
131136
secrets: inherit
132137

133138
pre_release:
@@ -143,7 +148,6 @@ jobs:
143148
- name: Checkout code
144149
uses: actions/checkout@v4
145150
with:
146-
ref: ${{ github.event.inputs.release_branch }}
147151
fetch-depth: 0
148152

149153
- name: Set up Node.js
@@ -245,7 +249,7 @@ jobs:
245249
REPO: ${{ github.repository }}
246250
PKG_NAME: ${{ env.PACKAGE_NAME }}
247251
PKG_VER: ${{ env.PACKAGE_VERSION }}
248-
REL_BRANCH: ${{ github.event.inputs.release_branch }}
252+
REL_BRANCH: ${{ github.ref_name }}
249253
VULN_ART_URL: ${{ steps.vuln_art.outputs.art_url }}
250254
LABELS: security
251255
run: |
@@ -298,6 +302,7 @@ jobs:
298302
env:
299303
PACKAGE_VERSION: "${{ needs.get_version.outputs.package_version }}"
300304
PACKAGE_NAME: "${{ github.event.inputs.package_name }}"
305+
RELEASE_BRANCH: "${{ github.ref_name }}"
301306
outputs:
302307
reviewers_dev: ${{ steps.get_reviewers.outputs.reviewers_dev }}
303308
reviewers_sec: ${{ steps.get_reviewers.outputs.reviewers_sec }}
@@ -306,15 +311,14 @@ jobs:
306311
- name: Checkout code
307312
uses: actions/checkout@v4
308313
with:
309-
ref: ${{ github.event.inputs.release_branch }}
310314
fetch-depth: 0
311315
- name: Create PR from release branch to main (skips for rc/beta)
312316
id: ensure_pr
313317
if: ${{ github.event.inputs.npmjs_dist_tag == '' || github.event.inputs.npmjs_dist_tag == 'latest' }}
314318
env:
315319
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
316320
REPO: ${{ github.repository }}
317-
RELEASE_BRANCH: ${{ github.event.inputs.release_branch }}
321+
RELEASE_BRANCH: ${{ github.ref_name }}
318322
VERSION: ${{ needs.get_version.outputs.package_version }}
319323
run: |
320324
set -euo pipefail
@@ -423,7 +427,6 @@ jobs:
423427
run: |
424428
set -euo pipefail
425429
ARTIFACT_NAME="vulnerability-report"
426-
RELEASE_BRANCH="${{ github.event.inputs.release_branch }}"
427430
COMMIT_SHA="$(git rev-parse --short HEAD)"
428431
429432
echo "Fetching artifact ID for ${ARTIFACT_NAME}..."
@@ -534,7 +537,6 @@ jobs:
534537
- name: Checkout code
535538
uses: actions/checkout@v4
536539
with:
537-
ref: ${{ github.event.inputs.release_branch }}
538540
fetch-depth: 0
539541

540542
- name: Download artifact

RELEASE.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,22 @@ You can manually trigger the release workflow from the [GitHub Actions UI](https
1010

1111
### **Before triggering a release**
1212

13-
1. Create a release branch and update the **`version`** field in `packages/<package_name>/package.json` to the intended release version.
13+
1. Create a release branch. A qualified branch name should start with "release-" or "release/", case-insensitive. e.g: `release/xrpl@4.3.8`, `release-xrpl-4.3.8`, `Release/xrpl@4.3.8`.
14+
2. Update the **`version`** field in `packages/<package_name>/package.json` to the intended release version.
1415
```json
1516
{
1617
"name": "<package_name>",
1718
"version": "x.y.z"
1819
}
1920
```
20-
2. Run npm i to update the package-lock with the updated versions and commit the lock file to the releaes branch
21+
3. Run npm i to update the package-lock with the updated versions and commit the lock file to the release branch
2122

2223
### **Triggering a Release**
2324

2425
1. Go to **GitHub → Actions → Release Pipeline → Run workflow**
25-
2. Fill in these fields:
26+
2. Choose the release branch from dropdown
27+
3. Fill in these fields:
2628
- **package_name** → The folder name under `packages/`, e.g., `xrpl` or `ripple-address-codec`.
27-
- **release_branch** → The Git branch the release is generated from, e.g., `release/xrpl@4.3.8`.
2829
- **npmjs_dist_tag** → The npm distribution tag to publish under. Defaults to `latest`.
2930
- Examples:
3031
- `latest` → Standard production release
@@ -36,13 +37,12 @@ You can manually trigger the release workflow from the [GitHub Actions UI](https
3637
| Field | Example |
3738
|------------------|-----------------------|
3839
| package_name | xrpl |
39-
| release_branch | release/xrpl@4.3.8 |
4040
| npmjs_dist_tag | latest |
4141

4242

4343
### **Reviewing the release details and scan result**
4444

45-
1. The pipeline will pause at the "Review test and security scan result" step, at least 2 approvers are required to review and approve the release.
45+
1. The pipeline will pause at the "Print Test/Security scan result and invite Dev team to review" step and also before the final release step, relevant team should review the release details and scan result.
4646

4747

4848
---

0 commit comments

Comments
 (0)