Publish the shared library to npmjs #3
This file contains hidden or 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: Publish @netfoundry/docusaurus-shared | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write # Required for OIDC. see https://docs.npmjs.com/trusted-publishers#supported-cicd-providers | |
| contents: read | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: lib/packages/docusaurus-shared | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'yarn' | |
| cache-dependency-path: lib/yarn.lock | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| working-directory: lib | |
| - name: Check version not published | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if npm view @netfoundry/docusaurus-shared@$VERSION version 2>/dev/null; then | |
| echo "::error::Version $VERSION already exists on npm" | |
| exit 1 | |
| fi | |
| echo "Version $VERSION is available" | |
| - name: Build and test | |
| run: yarn build && yarn test | |
| - name: Publish to NPM | |
| run: yarn publish --access public |