Skip to content

Commit 09ae85b

Browse files
committed
chore: update GitHub Actions workflow to improve npm publish process and version handling
1 parent 68ec014 commit 09ae85b

1 file changed

Lines changed: 6 additions & 19 deletions

File tree

.github/workflows/main.yml

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
with:
2929
node-version: "20"
3030
registry-url: "https://registry.npmjs.org"
31-
package-manager-cache: false # never use caching in release builds
31+
cache-dependency-path: package-lock.json
3232

3333
- name: Install dependencies
3434
run: npm ci
@@ -41,14 +41,15 @@ jobs:
4141
git config --global user.email "jaystack-ci@jaystack.com"
4242
git config --global user.name "jaystack-ci"
4343
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
44-
npm version ${{ inputs.version_type }} -m "Auto-increment version: %s" --force
45-
npm publish --tag dev --provenance --access public
44+
npm version ${{ inputs.version_type }} -m "Auto-increment version: %s"
45+
npm publish --tag dev
4646
4747
- name: Git operations
4848
run: |
4949
git tag -f dev
5050
git push -f --tags
5151
git push
52+
5253
stage:
5354
needs: dev
5455
runs-on: ubuntu-latest
@@ -63,19 +64,12 @@ jobs:
6364
with:
6465
node-version: "20"
6566
registry-url: "https://registry.npmjs.org"
66-
package-manager-cache: false # never use caching in release builds
6767

6868
- name: Extract package version
6969
id: package_version
70-
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
70+
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
7171
shell: bash
7272

73-
- name: Configure Git
74-
run: |
75-
git config --global user.email "jaystack-ci@jaystack.com"
76-
git config --global user.name "jaystack-ci"
77-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
78-
7973
- name: Create and push git tag
8074
run: |
8175
git tag -f stage
@@ -98,19 +92,12 @@ jobs:
9892
with:
9993
node-version: "20"
10094
registry-url: "https://registry.npmjs.org"
101-
package-manager-cache: false # never use caching in release builds
10295

10396
- name: Extract package version
10497
id: package_version
105-
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
98+
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
10699
shell: bash
107100

108-
- name: Configure Git
109-
run: |
110-
git config --global user.email "jaystack-ci@jaystack.com"
111-
git config --global user.name "jaystack-ci"
112-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
113-
114101
- name: Create and push git tag
115102
run: |
116103
git tag -f latest

0 commit comments

Comments
 (0)