Skip to content

Commit 235d871

Browse files
fix(ci): release from the dispatched branch instead of a branch input (#1675)
1 parent 7237bf2 commit 235d871

3 files changed

Lines changed: 11 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@ permissions:
44
contents: read
55
id-token: write
66

7-
on:
8-
pull_request:
9-
workflow_call:
10-
inputs:
11-
branch:
12-
description: "Branch to checkout"
13-
required: false
14-
default: master
15-
type: string
7+
on: [pull_request, workflow_call]
168

179
jobs:
1810
shared-ci:
1911
uses: ./.github/workflows/shared-ci.yml
20-
with:
21-
branch: ${{ inputs.branch || 'master' }}
2212
pr-ci-all-required:
2313
if: always()
2414
needs:

.github/workflows/prod-release.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ on:
1414
description: 'NPM distribution tag'
1515
required: false
1616
default: 'latest'
17-
branch:
18-
description: 'The branch to release from'
19-
required: false
20-
default: 'master'
2117

2218
env:
2319
NODE_OPTIONS: "--max-old-space-size=4096"
@@ -35,6 +31,12 @@ jobs:
3531
needs: [pre-release-ci]
3632
environment: release
3733
steps:
34+
- name: Require a branch
35+
if: github.ref_type != 'branch'
36+
run: |
37+
echo "::error::Dispatch this workflow from a branch (got ${{ github.ref_type }} '${{ github.ref_name }}'). To release a specific commit, point a branch at it first."
38+
exit 1
39+
3840
- name: Checkout code
3941
uses: actions/checkout@v4
4042
with:
@@ -76,11 +78,11 @@ jobs:
7678
7779
- name: Configure git
7880
env:
79-
BRANCH: ${{ github.event.inputs.branch }}
81+
BRANCH: ${{ github.ref_name }}
8082
run: |
8183
git config --global user.name "aws-crypto-tools-ci-bot"
8284
git config --global user.email "no-reply@noemail.local"
83-
git checkout $BRANCH
85+
git checkout "$BRANCH"
8486
8587
- name: Version packages
8688
env:
@@ -96,9 +98,10 @@ jobs:
9698
needs: [pre-release-ci, version]
9799
environment: release
98100
steps:
101+
# Include the version-bump commit the version job pushed
99102
- uses: actions/checkout@v4
100103
with:
101-
ref: ${{ github.event.inputs.branch }}
104+
ref: ${{ github.ref_name }}
102105

103106
- uses: actions/setup-node@v4
104107
with:

.github/workflows/shared-ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,6 @@ name: Shared CI Tests
33
on:
44
workflow_call:
55
inputs:
6-
branch:
7-
description: "Branch to checkout"
8-
required: false
9-
default: master
10-
type: string
116
test-published-packages:
127
description: 'Test against published packages instead of checked out code'
138
required: false
@@ -39,7 +34,6 @@ jobs:
3934
# Always need repo for test scripts and configuration, even when testing published packages
4035
uses: actions/checkout@v4
4136
with:
42-
ref: ${{ inputs.branch }}
4337
fetch-depth: 0
4438
submodules: true
4539

0 commit comments

Comments
 (0)