Skip to content

Commit 8e4c137

Browse files
committed
Merge branch 'feature/pr-prerelease-packages' into feature/linear-kernel-opencv
2 parents 22b3166 + 62b51a8 commit 8e4c137

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,42 @@ jobs:
5858
**/*test-results*
5959
**/*coverage*
6060
retention-days: 7
61+
62+
publish-pr:
63+
if: >-
64+
github.event_name == 'pull_request' &&
65+
github.event.pull_request.head.repo.full_name == github.repository
66+
needs: build
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: read
70+
packages: write
71+
steps:
72+
- name: Download build artifact
73+
uses: actions/download-artifact@v5
74+
with:
75+
name: build-dist
76+
path: ./package
77+
78+
- name: Setup Node.js for GitHub Packages
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: "22"
82+
registry-url: "https://npm.pkg.github.com"
83+
scope: "@crispthinking"
84+
85+
- name: Set pre-release version
86+
working-directory: ./package
87+
run: |
88+
PR_NUMBER=${{ github.event.pull_request.number }}
89+
SHORT_SHA=${GITHUB_SHA::7}
90+
VERSION="0.0.0-pr.${PR_NUMBER}.${SHORT_SHA}"
91+
npm --no-git-tag-version version "$VERSION"
92+
93+
- name: Publish pre-release package
94+
working-directory: ./package
95+
env:
96+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
run: |
98+
PR_TAG="pr-${{ github.event.pull_request.number }}"
99+
npm publish --tag "$PR_TAG"

0 commit comments

Comments
 (0)