-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (69 loc) · 2.42 KB
/
Copy pathpublish-metaboost-signing.yml
File metadata and controls
79 lines (69 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Publish packages/metaboost-signing to the public npm registry.
# Versioning: bump package.json version, then tag metaboost-signing-vX.Y.Z and push.
name: Publish metaboost-signing
on:
workflow_dispatch:
inputs:
dry_run:
description: "If true, run npm publish --dry-run only (no registry write). Set false to publish the current package version from this ref."
required: false
type: boolean
default: true
push:
tags:
- "metaboost-signing-v*"
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "npm"
registry-url: "https://registry.npmjs.org"
- name: Pin npm version
run: npm install -g npm@11.13.0
- name: Install dependencies
run: |
set -euo pipefail
for attempt in 1 2 3 4 5; do
if npm ci; then
break
fi
echo "npm ci failed (attempt $attempt/5); retrying in 15s..." >&2
sleep 15
if [[ "$attempt" -eq 5 ]]; then
exit 1
fi
done
- name: Verify tag matches package version
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
REF: ${{ github.ref }}
run: |
TAG_VER="${REF#refs/tags/metaboost-signing-v}"
PKG_VER=$(node -p "require('./packages/metaboost-signing/package.json').version")
if [ "$TAG_VER" != "$PKG_VER" ]; then
echo "Tag version ($TAG_VER) must equal packages/metaboost-signing/package.json version ($PKG_VER)."
exit 1
fi
- name: Build and test package
run: |
npm run build -w metaboost-signing
npm run test -w metaboost-signing
npm run lint -w metaboost-signing
- name: Publish to npm (dry run)
if: github.event_name == 'workflow_dispatch' && inputs.dry_run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish -w metaboost-signing --access public --dry-run
- name: Publish to npm
if: github.event_name != 'workflow_dispatch' || !inputs.dry_run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish -w metaboost-signing --access public