generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
71 lines (58 loc) · 2.22 KB
/
alpha-npm.yml
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
name: Alpha to NPM Registry
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allow only one concurrent deployment,but do NOT cancel in-progress runs as
# we want to allow these alpha deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
id-token: write # necessary for NPM provenance
jobs:
publish-alpha-npm:
name: NPM Publish
runs-on: ubuntu-latest
env:
# Packages not listed here will be excluded from publishing
PACKAGES: "agent api common credentials crypto dids identity-agent proxy-agent user-agent"
steps:
- name: Checkout source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Set up Node.js
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install latest npm
run: npm install -g npm@latest
# Note - this is not required but it gives a clean failure prior to attempting a release if
# the GH workflow runner is not authenticated with NPMjs.com
- name: Verify NPM token is authenticated with NPMjs.com
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
run: npm whoami
- name: Install dependencies
run: npm ci
- name: Generate alpha prerelease and bump package.json @web5/* versions
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
run: |
SHORT_COMMIT_SHA=$(git rev-parse --short HEAD)
YYYYMMDD=$(date +'%Y%m%d')
ALPHA_PRERELEASE="alpha-$YYYYMMDD-$SHORT_COMMIT_SHA"
node ./scripts/bump-workspace.mjs --prerelease=$ALPHA_PRERELEASE
shell: bash
- name: Build all workspace packages
run: npm run build
- name: Publish selected @web5/* packages
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
run: |
for package in $PACKAGES; do
cd packages/$package
npm publish --tag alpha --no-git-tag-version --access public --provenance
cd ../..
done
shell: bash