Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish snapshot package
on:
push:
branches: ['master']
release:
types: [published]

permissions:
contents: read
id-token: write
jobs:
publish-snapshots:
env:
NODE_OPTIONS: --openssl-legacy-provider
environment:
name: NPMJS
url: ${{ steps.publish.outputs.url }}
name: Publish snapshot packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: '>=24.7.0'
- run: npm i
- if: ${{ github.event_name == 'push' }}
run: |
PACKAGE_NAME=$(jq --raw-output .name package.json)
npm version prerelease --preid=snapshot --no-git-tag-version
PREFIX=$(jq --raw-output .version package.json | sed 's/\.[0-9]\+$//')
NEXT=$(npm view $PACKAGE_NAME versions --json \
| jq --raw-output --arg prefix $PREFIX '[.[] | select(startswith($prefix))|capture("snapshot\\.(?<n>[0-9]+)").n|tonumber]|max + 1 // 0')
npm version $PREFIX.$NEXT --no-git-tag-version
echo "TAG=snapshot" >> $GITHUB_ENV
- if: ${{ github.event_name == 'release' }}
run: |
npm version $(echo ${{ github.release.tag_name }} | sed 's/^v//') --no-git-tag-version
echo "TAG=latest" >> $GITHUB_ENV
- run: npm test
- id: publish
run: |
npm run build
npm publish --provenance --access public --tag $TAG
echo "url=https://www.npmjs.com/package/@waves/signer/v/$(jq --raw-output .version package.json)" >> "$GITHUB_OUTPUT"
Loading