|
1 | | -name: Publish snapshot package |
| 1 | +name: Publish NPM package |
2 | 2 | on: |
3 | 3 | push: |
4 | 4 | branches: [ 'master' ] |
5 | 5 | release: |
6 | 6 | types: [ published ] |
7 | 7 |
|
8 | | -permissions: |
9 | | - contents: read |
10 | | - id-token: write |
11 | 8 | jobs: |
12 | | - publish-snapshots: |
13 | | - environment: |
14 | | - name: NPMJS |
15 | | - url: ${{ steps.publish.outputs.url }} |
16 | | - name: Publish snapshot packages |
17 | | - runs-on: ubuntu-latest |
18 | | - steps: |
19 | | - - uses: actions/checkout@v4 |
20 | | - - uses: actions/setup-node@v4 |
21 | | - with: |
22 | | - registry-url: 'https://registry.npmjs.org' |
23 | | - node-version: '>=24.7.0' # Trusted publishing requires npm CLI version 11.5.1 or later. |
24 | | - - run: npm i |
25 | | - - if: ${{ github.event_name == 'push' }} |
26 | | - run: | |
27 | | - PACKAGE_NAME=$(jq --raw-output .name package.json) |
28 | | - npm version prerelease --preid=snapshot --no-git-tag-version |
29 | | - PREFIX=$(jq --raw-output .version package.json | sed 's/\.[0-9]\+$//') |
30 | | - NEXT=$(npm view $PACKAGE_NAME versions --json \ |
31 | | - | jq --raw-output --arg prefix $PREFIX '[.[] | select(startswith($prefix))|capture("snapshot\\.(?<n>[0-9]+)").n|tonumber]|max + 1 // 0') |
32 | | - npm version $PREFIX.$NEXT --no-git-tag-version |
33 | | - echo "TAG=snapshot" >> $GITHUB_ENV |
34 | | - - if: ${{ github.event_name == 'release' }} |
35 | | - run: | |
36 | | - npm version $(echo ${{ github.release.tag_name }} | sed 's/^v//') --no-git-tag-version |
37 | | - echo "TAG=latest" >> $GITHUB_ENV |
38 | | - - id: publish |
39 | | - run: | |
40 | | - npm run build |
41 | | - npm publish --provenance --access public --tag $TAG |
42 | | - echo "url=https://www.npmjs.com/package/@waves/ts-lib-crypto/v/$(jq --raw-output .version package.json)" >> "$GITHUB_OUTPUT" |
| 9 | + publish: |
| 10 | + uses: wavesplatform/publish-to-npm/.github/workflows/publish.yml@7d9462af686d83552d72097bf47a892e43d11f6e |
| 11 | + with: |
| 12 | + environment: NPMJS |
| 13 | + event_name: ${{ github.event_name }} |
| 14 | + test: true |
| 15 | + version: ${{ github.event.release.tag_name }} |
| 16 | + permissions: |
| 17 | + id-token: write |
| 18 | + contents: read |
0 commit comments