Skip to content

npm: 0.1.0

npm: 0.1.0 #1

Workflow file for this run

name: Publish npm packages
on:
release:
types: [published]
permissions:
contents: read
id-token: write
jobs:
publish:
if: startsWith(github.event.release.tag_name, 'npm/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
registry-url: https://registry.npmjs.org
- name: Validate npm release
shell: bash
env:
RELEASE_NAME: ${{ github.event.release.name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
set -euo pipefail
version=$(node -p "require('./package.json').version")
expected_tag="npm/$version"
expected_title="npm: $version"
if [[ "$RELEASE_TAG" != "$expected_tag" ]]; then
echo "Expected release tag '$expected_tag'." >&2
echo "Got '$RELEASE_TAG'." >&2
exit 1
fi
if [[ "$RELEASE_NAME" != "$expected_title" ]]; then
echo "Expected release title '$expected_title'." >&2
echo "Got '$RELEASE_NAME'." >&2
exit 1
fi
- run: pnpm install --frozen-lockfile --ignore-scripts
- name: Prepare self-contained package
env:
GH_TOKEN: ${{ github.token }}
RELEASE_REPOSITORY: ${{ github.repository }}
run: pnpm prepare && pnpm package:npm
- name: Build hosted-WASM package
env:
CLANGD_WASM_BASE: https://clangd.cpp.social/wasm/
run: |
pnpm build:hosted
pnpm package:npm:hosted
- name: Install current npm
run: npm install --global npm@latest
- name: Inspect packages
run: |
npm pack ./packages/codeblocks --dry-run
npm pack ./packages/codeblocks-hosted --dry-run
- name: Publish @cppsocial/codeblocks
run: npm publish ./packages/codeblocks --access public --provenance
- name: Publish @cppsocial/codeblocks-hosted
run: npm publish ./packages/codeblocks-hosted --access public --provenance