chore: 文档调整 #106
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Publish orca-pocket | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- 'packages/*/package.json' | |
- 'package.json' | |
- 'pnpm-lock.yaml' | |
- '.github/workflows/publish.yml' | |
jobs: | |
replace-package-json-and-publish: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
packages: write | |
pull-requests: write | |
issues: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: install dependencies | |
run: | | |
npm i pnpm -g | |
pnpm i --no-frozen-lockfile | |
- name: publish | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: npm run pub:only | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Format publish log | |
id: publish_log | |
uses: actions/github-script@v4 | |
if: steps.changesets.outputs.published == 'true' | |
with: | |
script: | | |
console.log(`::set-output name=log::${ | |
${{ steps.changesets.outputs.publishedPackages }}.map(({name,version}) => ' - '+name+'@'+version).join('\n') | |
}`) | |
- name: Dingtalk Notify | |
uses: zcong1993/actions-ding@master | |
if: steps.changesets.outputs.published == 'true' | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
body: | | |
{ | |
"msgtype": "markdown", | |
"markdown": { | |
"title":"orca-fe 发布通知", | |
"text": "### @orca-fe/pocket\n\n流水线结束,以下模块已发布:\n\n${{ steps.changelog.outputs.changes }}" | |
}, | |
"at": { | |
"isAtAll": false | |
} | |
} | |
- name: Dingtalk Notify Error | |
uses: zcong1993/actions-ding@master | |
if: steps.changesets.outputs.published == 'false' || steps.changesets.outputs.hasChangesets == 'false' | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
body: | | |
{ | |
"msgtype": "markdown", | |
"markdown": { | |
"title":"orca-fe 未发布通知", | |
"text": "### @orca-fe/pocket\n\n流水线结束,未发布模块。" | |
} | |
} |