update #11
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
name: Pre Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
pre-publish: | |
# needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Set timezone to Asia/Shanghai | |
uses: szenius/[email protected] | |
with: | |
timezoneLinux: "Asia/Shanghai" | |
- name: Echo current time | |
run: timedatectl | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.11.1 | |
- name: Install pnpm | |
run: | | |
npm install -g pnpm | |
# pnpm config set store-dir $(pwd)/.pnpm-store | |
# pnpm config set recursive-optional true | |
- name: Install Dependence | |
run: pnpm i | |
- name: Build dist | |
run: | | |
git pull -p | |
pnpm run build | |
- name: Pre publish | |
run: npm publish --dry-run | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- uses: dorny/paths-filter@v3 | |
id: changes | |
with: | |
filters: | | |
update: | |
- 'main/**' | |
- 'types/**' | |
- 'utils/**' | |
- README.md | |
- package.json | |
- rollup.config.js | |
- tsconfig.json | |
- .babelrc | |
- name: Repository Dispatch | |
if: steps.changes.outputs.update == 'true' | |
uses: peter-evans/repository-dispatch@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# 也可以直接写成R: GITHUB_REPOSITORY | |
# https://docs.github.com/zh/actions/learn-github-actions/variables | |
repository: ${{ github.repository }} | |
event-type: to-publish-npm |