Skip to content

Commit aa704aa

Browse files
Harden release workflow: bumpVersion input, echohq registry, scope nightly permissions
1 parent 8669b2f commit aa704aa

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/nightly.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name: Nightly Release
22

33
permissions:
4-
id-token: write
5-
contents: write
6-
packages: write
4+
contents: read
75

86
on:
97
push:

.github/workflows/release.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ on:
1818
required: false
1919
default: true
2020
type: boolean
21+
bumpVersion:
22+
description: 'Bump npm version, create and merge version PR'
23+
required: false
24+
default: true
25+
type: boolean
2126
workflow_dispatch:
2227
inputs:
2328
cliTag:
@@ -33,6 +38,11 @@ on:
3338
required: false
3439
default: true
3540
type: boolean
41+
bumpVersion:
42+
description: 'Bump npm version, create and merge version PR'
43+
required: false
44+
default: true
45+
type: boolean
3646

3747
permissions:
3848
contents: read
@@ -72,18 +82,26 @@ jobs:
7282
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
7383
with:
7484
node-version: 22.11.0
75-
registry-url: https://npm.pkg.github.com/
85+
registry-url: https://npm.echohq.com/
86+
87+
- name: Configure GitHub Packages auth
88+
env:
89+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: npm config set //npm.pkg.github.com/:_authToken "${GH_TOKEN}"
7691

7792
- name: Generate Tag name
7893
id: generate_tag_name
7994
env:
8095
INPUT_DEV: ${{ inputs.dev }}
8196
INPUT_JS_TAG: ${{ inputs.jsTag }}
97+
INPUT_BUMP_VERSION: ${{ inputs.bumpVersion }}
8298
run: |
8399
if [ "$INPUT_DEV" == "true" ]; then
84100
TAG_NAME=$(npm version prerelease --preid="$INPUT_JS_TAG" --no-git-tag-version --allow-same-version)
85-
else
101+
elif [ "$INPUT_BUMP_VERSION" == "true" ]; then
86102
TAG_NAME=$(npm version patch --no-git-tag-version)
103+
else
104+
TAG_NAME=v$(node -p "require('./package.json').version")
87105
fi
88106
89107
echo "Generated TAG_NAME: $TAG_NAME"
@@ -124,7 +142,7 @@ jobs:
124142
125143
- name: Create Pull Request
126144
id: create_pr
127-
if: inputs.dev == false
145+
if: inputs.dev == false && inputs.bumpVersion == true
128146
uses: step-security/create-pull-request@50c103da2b9ca12cd5bc013fc6931051a5aa872b # v8.1.1
129147
with:
130148
token: ${{ env.GITHUB_TOKEN }}
@@ -136,13 +154,13 @@ jobs:
136154

137155
- name: Wait for PR to be created
138156
id: pr
139-
if: inputs.dev == false
157+
if: inputs.dev == false && inputs.bumpVersion == true
140158
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
141159
with:
142160
route: GET /repos/${{ github.repository }}/pulls?head=${{ github.repository_owner }}:${{ env.BRANCH_NAME }}
143161

144162
- name: Merge Pull Request
145-
if: inputs.dev == false
163+
if: inputs.dev == false && inputs.bumpVersion == true
146164
uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0
147165
with:
148166
route: PUT /repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull-request-number }}/merge

0 commit comments

Comments
 (0)