Skip to content

Commit 8378663

Browse files
authored
Updated workflow (#12)
1 parent cb66661 commit 8378663

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

.github/workflows/publish.yml

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
1-
name: Publish snapshot package
1+
name: Publish NPM package
22
on:
33
push:
44
branches: [ 'master' ]
55
release:
66
types: [ published ]
77

8-
permissions:
9-
contents: read
10-
id-token: write
118
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

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@
2929
],
3030
"dependencies": {
3131
"@types/cli-color": "^2.0.6",
32-
"@types/dotenv": "^8.2.0",
3332
"@types/fs-extra": "^11.0.4",
3433
"@types/yargs": "^17.0.35",
35-
"@waves/node-api-js": "1.3.11-beta.1",
36-
"@waves/ts-types": "1.3.1-snapshot.1",
37-
"@waves/waves-transactions": "4.3.11",
34+
"@waves/node-api-js": "^1.3.11-beta.1",
35+
"@waves/ts-types": "^1.3.1",
36+
"@waves/waves-transactions": "^4.4.0-snapshot.2",
3837
"cli-color": "^2.0.4",
3938
"dotenv": "^8.2.0",
4039
"fs-extra": "^11.0.4",

0 commit comments

Comments
 (0)