Skip to content

Commit 7b2b1ae

Browse files
committed
[CI/CD] version sync with npm github
1 parent 1f7a53a commit 7b2b1ae

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ jobs:
1212
permissions:
1313
contents: write
1414

15+
outputs:
16+
new_version: ${{ steps.bump_version.outputs.version }}
17+
1518
steps:
1619
- name: Checkout repository
1720
uses: actions/checkout@v4
@@ -40,6 +43,7 @@ jobs:
4043
run: yarn workspaces foreach --all --topological --parallel --no-private run build
4144

4245
- name: Bump version & commit (only on main)
46+
id: bump_version
4347
if: github.ref == 'refs/heads/main'
4448
run: |
4549
yarn workspaces foreach --all version patch
@@ -48,33 +52,21 @@ jobs:
4852
git config user.email "github-actions[bot]@users.noreply.github.com"
4953
git add -A
5054
git commit -m "chore(release): bump versions"
51-
git tag v$(jq -r .version package.json)
55+
NEW_VERSION=$(jq -r .version package.json)
56+
git tag v$NEW_VERSION
5257
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
5358
git push --follow-tags
59+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
5460
5561
- name: Publish to npm using yarn workspaces
5662
if: github.ref == 'refs/heads/main'
5763
run: yarn workspaces foreach --verbose --all --topological --no-private npm publish --access public
5864

59-
get-version:
60-
runs-on: ubuntu-latest
61-
outputs:
62-
version: ${{ steps.get-version.outputs.version }}
63-
steps:
64-
- name: Checkout
65-
uses: actions/checkout@v4
66-
67-
- name: Get version from package.json
68-
id: get-version
69-
run: |
70-
VERSION=$(jq -r .version package.json)
71-
echo "version=$VERSION" >> $GITHUB_OUTPUT
72-
7365
call-publish:
74-
needs: [build, get-version]
66+
needs: [build]
7567
uses: ./.github/workflows/release.yml
7668
permissions:
7769
contents: write
7870
with:
79-
version: ${{ needs.get-version.outputs.version }}
71+
version: ${{ needs.build.outputs.new_version }}
8072

0 commit comments

Comments
 (0)