mermaid/.github/workflows/release-preview-publish.yml

45 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2019-10-16 03:23:22 +02:00
name: Publish release preview package
2019-10-15 22:43:36 +02:00
2019-10-16 21:57:35 +02:00
on:
push:
branches:
- 'release/**'
2019-10-15 22:43:36 +02:00
jobs:
2023-07-02 06:44:35 +02:00
publish-preview:
2019-10-15 22:43:36 +02:00
runs-on: ubuntu-latest
steps:
2022-09-04 21:30:47 +02:00
- uses: actions/checkout@v3
2022-11-16 07:00:58 +01:00
with:
fetch-depth: 0
2022-11-15 19:36:47 +01:00
- uses: pnpm/action-setup@v2
2022-09-04 21:30:47 +02:00
- name: Setup Node.js
uses: actions/setup-node@v3
with:
2022-11-15 19:36:47 +01:00
cache: pnpm
2022-10-10 14:13:50 +02:00
node-version: 18.x
2022-11-15 19:36:47 +01:00
- name: Install Packages
run: |
pnpm install --frozen-lockfile
env:
CYPRESS_CACHE_FOLDER: .cache/Cypress
2019-10-15 22:43:36 +02:00
2022-09-04 21:30:47 +02:00
- name: Install Json
run: npm i json --global
2019-10-16 03:34:22 +02:00
2022-09-04 21:30:47 +02:00
- name: Publish
2022-11-16 05:19:41 +01:00
working-directory: ./packages/mermaid
2022-09-04 21:30:47 +02:00
run: |
PREVIEW_VERSION=$(git log --oneline "origin/$GITHUB_REF_NAME" ^"origin/master" | wc -l)
2022-09-04 21:30:47 +02:00
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 ${{ secrets.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
npm publish