1068 context docs generation #1719
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: npm-build | |
# This workflow publishes releases to NPM, after checking that the version they would create does not already exist. | |
# Hence, it will only publish if the version number in package.json is not already listed at: | |
# https://www.npmjs.com/package/@finos/fdc3?activeTab=versions | |
# The workflow will: | |
# - Only trigger on a push or PR merge to a release/* branch in the repository | |
# - Ignore Docusaurus workflow, docs/** and website/** as they don't affect the NPM module build | |
# WARNING: the workflow does NOT confirm that the version number in package JSON matches the branch name, which should be manually confirmed | |
on: | |
push: | |
branches: | |
- release/** | |
paths-ignore: | |
- '.github/workflows/docusaurus.yml' | |
- 'docs/**' | |
- 'website/**' | |
pull_request: | |
types: [opened, reopened, edited, ready_for_review] | |
branches: | |
- main | |
- release/* | |
paths-ignore: | |
- '.github/workflows/docusaurus.yml' | |
- 'docs/**' | |
- 'website/**' | |
permissions: | |
contents: read | |
jobs: | |
package-build: | |
name: Build on Node ${{ matrix.node }} and ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node: [20] | |
os: [ubuntu-latest, windows-latest] | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Use Node ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Install dependencies | |
uses: bahmutov/npm-install@2509f13e8485d88340a789a3f7ca11aaac47c9fc #v1.8.36 | |
- name: Lint | |
run: npm run lint | |
- name: Test | |
run: npm run test --ci --coverage --maxWorkers=2 | |
- name: Build | |
run: npm run build | |
package-publish: | |
if: ${{ github.event_name == 'push' }} | |
needs: package-build | |
name: Publish package to ${{ matrix.name }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- name: NPM | |
registry: https://registry.npmjs.org | |
token-name: NPM_TOKEN | |
- name: GitHub | |
registry: https://npm.pkg.github.com | |
token-name: GITHUB_TOKEN | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Configure Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: ${{ matrix.registry }} | |
- name: Check package version | |
id: check-version | |
uses: tehpsalmist/npm-publish-status-action@deb911186cfe5134094f49183364da10a986e4e7 | |
# Disabled when switching from PostHog/check-package-version as the new lib | |
# just tells you if your version exists or not | |
# - name: Package version info | |
# run: | | |
# echo "Committed version: ${{ steps.check-version.outputs.committed-version }}" | |
# echo "Published version: ${{ steps.check-version.published-version }}" | |
# echo "Is version new: ${{ steps.check-version.outputs.is-new-version }}" | |
- name: Report already published status | |
if: steps.check-version.outputs.exists == '1' | |
run: 'echo "package version already exists on npm registry"' | |
- name: Report not yet published status | |
if: steps.check-version.outputs.exists == '0' | |
run: 'echo "package version does not exist on npm registry, publishing..."' | |
- name: Install dependencies | |
if: steps.check-version.outputs.exists == '0' | |
uses: bahmutov/npm-install@2509f13e8485d88340a789a3f7ca11aaac47c9fc #v1.8.36 | |
- name: Publish | |
if: steps.check-version.outputs.exists == '0' | |
run: npm publish --provenance --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets[matrix.token-name] }} |