Skip to content

chore: 发布测试 #110

chore: 发布测试

chore: 发布测试 #110

Workflow file for this run

# 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@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
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@v7
if: steps.changesets.outputs.published == 'true'
with:
script: |
console.log(JSON.stringify(`log=${
${{ steps.changesets.outputs.publishedPackages }}.map(({name,version}) => ' - '+name+'@'+version).join('\n')
}`), '>> $GITHUB_OUTPUT')
- 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.publish_log.logs }}"
},
"at": {
"isAtAll": false
}
}
- name: Dingtalk Notify Error
uses: zcong1993/actions-ding@master
if: steps.changesets.outputs.published == 'false'
with:
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }}
body: |
{
"msgtype": "markdown",
"markdown": {
"title":"orca-fe 未发布通知",
"text": "### @orca-fe/pocket\n\n流水线结束,未发布模块。"
}
}