Skip to content

Commit

Permalink
test: changesets
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoKam committed May 2, 2024
1 parent 2db1cf5 commit 500761e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/changesets-auto-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ name: changesets-auto-pr

on:
workflow_dispatch:
push:
branches-ignore:
pull_request:
types: [ opened, reopened ]
branches:
- master
paths:
- '.changeset/*'

jobs:
replace-package-json-and-publish:
Expand All @@ -31,15 +30,18 @@ jobs:
id: changesetStatus
run: |
node ./changeset-status.cjs
- name: changesets-version
id: changesets
uses: changesets/action@v1
with:
title: Pull Request ${{ steps.changesetStatus.outputs.status }}
version: node ./node_modules/@changesets/cli/bin.js version --snapshot prepublish
publish: npm run pub:only
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: changesets-version
# id: changesets
# uses: changesets/action@v1
# with:
# title: Pull Request ${{ steps.changesetStatus.outputs.status }}
# version: node ./node_modules/@changesets/cli/bin.js version --snapshot prepublish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: changesets update version
run: changeset version --snapshot prepublish
- name: Pre Publish
run: npm run pub:pre
- name: Dingtalk Notify
uses: zcong1993/actions-ding@master
if: steps.changesets.outputs.hasChangesets == 'true'
Expand All @@ -49,8 +51,8 @@ jobs:
{
"msgtype": "markdown",
"markdown": {
"title":"orca-fe PR 创建提示",
"text": "## Orca-Pocket PR 已创建\n 请查看[PR列表](https://github.com/orca-team/pocket/pulls)"
"title":"orca-fe 发布提醒",
"text": "## Orca-Pocket 临时版本已发布\n "
},
"at": {
"isAtAll": false
Expand Down
1 change: 1 addition & 0 deletions changeset-status.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ execSync(`npx changeset status --output changeset-status.json`);
const status = JSON.parse(fs.readFileSync('changeset-status.json'));
const message = [...new Set(status.changesets.map(({ summary }) => summary))].join('; ');
core.setOutput('status', message);
core.setOutput('hasChangesets', String(status.changesets.length > 0));
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"cv": "changeset && changeset version",
"pub": "npm run test && changeset publish && git push",
"pub:only": "npm run test && changeset publish",
"pub:pre": "changeset publish --tag prepublish",
"prettier": "prettier --write \"**/*.{js,jsx,tsx,ts,less,md,json}\"",
"lint-staged": "lint-staged",
"test": "pnpm --filter=@orca-fe/* run test ",
Expand Down

0 comments on commit 500761e

Please sign in to comment.