Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/release-preview-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- 'release/**'

permissions:
contents: read
packages: write

jobs:
publish-preview:
runs-on: ubuntu-latest
Expand All @@ -23,6 +27,8 @@ jobs:

- 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
Expand All @@ -41,6 +47,11 @@ jobs:
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
npm publish
# 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'
6 changes: 5 additions & 1 deletion packages/mermaid/scripts/update-release-version.mts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import {

const verifyOnly: boolean = process.argv.includes('--verify');
const versionPlaceholder = '<MERMAID_RELEASE_VERSION>';
/**
* This is so we can run `npm publish` for previews, without blocking the release.
*/
const onlyWarnOnVerifyError = process.env.ONLY_WARN_ON_VERIFY_ERROR === 'true';

const verifyDocumentation = async () => {
const fileContent = await readFile('./src/docs/community/contributing.md', 'utf-8');
Expand Down Expand Up @@ -51,7 +55,7 @@ const main = async () => {
console.log(
`${mdFilesWithPlaceholder.length} file(s) were found with the placeholder ${versionPlaceholder}. Run \`pnpm --filter mermaid docs:release-version\` to update them.`
);
process.exit(1);
process.exit(onlyWarnOnVerifyError ? 0 : 1);
}

for (const mdFile of mdFilesWithPlaceholder) {
Expand Down
Loading