feat: change workflow #137
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
# Install dependence and running `changesets publish` | |
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@latest-8 -g | |
pnpm i --no-frozen-lockfile | |
git config --global user.email "[email protected]" | |
git config --global user.name "action-robot" | |
git diff --quiet || git commit -am 'commit lock file' | |
- name: publish | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
title: Prepublish check | |
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 | |
run: node ./log.cjs | |
env: | |
CHANGESET_PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
CHANGESET_PUBLISHED: ${{ steps.changesets.outputs.published }} | |
CHANGESET_HAS_CHANGESETS: ${{ steps.changesets.outputs.hasChangesets }} | |
CHANGESET_PULL_REQUEST_NUMBER: ${{ steps.changesets.outputs.pullRequestNumber }} | |
- name: Dingtalk Notify | |
uses: zcong1993/actions-ding@master | |
if: always() | |
with: | |
dingToken: ${{ secrets.DING_TALK_ACCESS_TOKEN }} | |
body: | | |
{ | |
"msgtype": "markdown", | |
"markdown": { | |
"title":"${{ steps.publish_log.outputs.title }}", | |
"text": "${{ steps.publish_log.outputs.content }}" | |
}, | |
"at": { | |
"isAtAll": false | |
} | |
} |