mirror of
https://github.com/moloch--/sliver-script
synced 2026-06-08 16:08:26 +00:00
Add publish workflow
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
environment: publish
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24.x
|
||||
registry-url: https://registry.npmjs.org
|
||||
cache: npm
|
||||
- name: Verify tag matches package version
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
TAG_NAME="${GITHUB_REF_NAME}"
|
||||
|
||||
if [[ ! "${TAG_NAME}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::error title=Invalid tag format::Tag '${TAG_NAME}' must use 'vMAJOR.MINOR.PATCH' (example: v2.0.0)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG_VERSION="${TAG_NAME#v}"
|
||||
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
||||
|
||||
if [ "${TAG_VERSION}" != "${PACKAGE_VERSION}" ]; then
|
||||
echo "::error title=Version mismatch::Tag '${TAG_NAME}' does not match package.json version '${PACKAGE_VERSION}'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Tag version matches package.json (${PACKAGE_VERSION})."
|
||||
- run: npm ci
|
||||
- run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -4,7 +4,8 @@ Sliver-script is a TypeScript/JavaScript client library for Sliver, it can be us
|
||||
|
||||
This library targets modern Sliver protobuf/gRPC APIs and provides a strongly-typed TypeScript-first client.
|
||||
|
||||
[](https://github.com/moloch--/sliver-script/actions/workflows/publish.yml)
|
||||
[](https://github.com/moloch--/sliver-script/actions/workflows/publish.yml)
|
||||
[](https://www.npmjs.com/package/sliver-script)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
|
||||
### Install
|
||||
|
||||
Reference in New Issue
Block a user