Skip to content

Commit d8423da

Browse files
committed
chore: fix ci to commit bumped version
1 parent 29007e6 commit d8423da

3 files changed

Lines changed: 29 additions & 4 deletions

File tree

.github/workflows/publish-npm.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ on:
5353
default: '.'
5454

5555
permissions:
56-
contents: read
56+
contents: write
5757
id-token: write
5858

5959
jobs:
@@ -93,11 +93,36 @@ jobs:
9393
shell: bash
9494
working-directory: ${{ inputs.build-working-directory }}
9595

96-
- name: 🏷️ Set Version
96+
- name: 🔧 Configure Git
97+
if: ${{ inputs.tag == 'latest' }}
98+
run: |
99+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
100+
git config --global user.name "github-actions[bot]"
101+
shell: bash
102+
103+
- name: 🏷️ Bump Version, Commit & Tag
104+
if: ${{ inputs.tag == 'latest' }}
105+
id: bump-version
106+
run: |
107+
NEW_TAG=$(npm version ${{ inputs.version }} --tag-version-prefix="v" --message "v%s")
108+
echo "tag=$NEW_TAG" >> "$GITHUB_OUTPUT"
109+
shell: bash
110+
working-directory: ${{ inputs.package-directory }}
111+
112+
- name: 🏷️ Set Version (no commit)
113+
if: ${{ inputs.tag != 'latest' }}
97114
run: npm version --no-git-tag-version --allow-same-version ${{ inputs.version }}
98115
shell: bash
99116
working-directory: ${{ inputs.package-directory }}
100117

118+
- name: 🔄 Push Version Commit & Tag
119+
if: ${{ inputs.tag == 'latest' }}
120+
run: |
121+
git push origin HEAD:${{ github.ref_name }}
122+
git push origin ${{ steps.bump-version.outputs.tag }}
123+
shell: bash
124+
working-directory: ${{ inputs.package-directory }}
125+
101126
- name: 🚀 Publish to npm
102127
run: npm publish --tag ${{ inputs.tag }}
103128
shell: bash

.github/workflows/release-orchestrator.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ on:
2222
- major
2323

2424
permissions:
25-
contents: read
25+
contents: write
2626
id-token: write
2727

2828
jobs:

.github/workflows/release-production.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
default: patch
1111

1212
permissions:
13-
contents: read
13+
contents: write
1414
id-token: write
1515

1616
jobs:

0 commit comments

Comments
 (0)