Alpha to NPM Registry #44
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 crypto-aws-kms dids identity-agent proxy-agent user-agent" | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1 | |
- uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3.0.0 | |
with: | |
version: 8 | |
- name: Set up Node.js | |
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
cache: 'pnpm' | |
# 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: pnpm whoami | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- 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: pnpm --recursive --stream build | |
- name: Publish selected @web5/* packages | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | |
run: | | |
for package in $PACKAGES; do | |
cd packages/$package | |
pnpm publish --tag alpha --no-git-tag-version --access public --provenance | |
cd ../.. | |
done | |
shell: bash |