Skip to content

Added a tolerance for an assertion #504

Added a tolerance for an assertion

Added a tolerance for an assertion #504

name: Publish release preview package
on:
push:
branches:
- 'release/**'
permissions:
contents: read
packages: write
jobs:
publish-preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
- name: Setup Node.js
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
with:
cache: pnpm
node-version-file: '.node-version'
- name: Install Packages
run: |
# Use hoisted mode to avoid `bundleDependencies` issues
echo 'nodeLinker: "hoisted"' >> pnpm-workspace.yaml
pnpm install --frozen-lockfile
env:
CYPRESS_CACHE_FOLDER: .cache/Cypress
- name: Install Json
run: npm i json@11.0.0 --global
- name: Publish
working-directory: ./packages/mermaid
run: |
PREVIEW_VERSION=$(git log --oneline "origin/$GITHUB_REF_NAME" ^"origin/master" | wc -l)
VERSION=$(echo "${GITHUB_REF}" | tail -c +20)-preview.$PREVIEW_VERSION
echo $VERSION
npm version --no-git-tag-version --allow-same-version $VERSION
npm set //npm.pkg.github.com/:_authToken "${GITHUB_TOKEN}"
npm set registry https://npm.pkg.github.com/mermaid-js
json -I -f package.json -e 'this.name="@mermaid-js/mermaid"' # Package name needs to be set to a scoped one because GitHub registry requires this
json -I -f package.json -e 'this.repository="git://github.com/mermaid-js/mermaid"' # Repo url needs to have a specific format too
# We don't publish a separate `@mermaid-js/parser` so bundle it instead
json -I -f package.json -e 'this.bundleDependencies??=[]' -e 'this.bundleDependencies.push("@mermaid-js/parser")'
pnpm pack
npm publish --tag preview *.tgz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Prevent `npm publish` from failing if the docs verification fails.
ONLY_WARN_ON_VERIFY_ERROR: 'true'