This repository has been archived by the owner on Nov 25, 2024. It is now read-only.
ci: add publish robot #5
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: Npm Publish | |
# 定义触发条件 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
cache: pnpm | |
- name: Install | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- uses: JS-DevTools/npm-publish@v3 | |
id: publish | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
- name: Send notification to Dingding | |
if: ${{ steps.publish.outputs.type }} | |
uses: mrkou47/action-dingding-webhook@main | |
env: | |
DINGDING_SECRET: ${{ secrets.DINGDING_SECRET }} | |
DINGDING_ACCESS_TOKEN: ${{ secrets.DINGDING_ACCESS_TOKEN }} | |
with: | |
title: Release ${{ steps.publish.outputs.name }} | |
text: ${{ steps.publish.outputs.version }} |