gkd-subscription/.github/workflows/release.yml
2023-10-04 00:57:53 +08:00

55 lines
1.5 KiB
YAML

name: Release
on:
push:
branches:
- 'main'
jobs:
release:
# prevent run on fork
if: ${{ github.repository == 'gkd-kit/subscription' && startsWith(github.event.head_commit.message, 'chore(main):') && contains(github.event.head_commit.message, 'release') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
- run: pnpm install
- run: pnpm run build
- name: Git commit
id: commit
run: |
git config --local user.email github-actions[bot]@users.noreply.github.com
git config --local user.name github-actions[bot]
git config --global core.autocrlf true
git config --global core.safecrlf false
git status
git add .
git commit -m "build: json,readme" -a
continue-on-error: true
- name: Git push
uses: ad-m/github-push-action@master
if: ${{ steps.commit.outcome == 'success' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Publish package
if: ${{ steps.commit.outcome == 'success' }}
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm publish
- name: sync npmmirror
run: curl -X PUT 'https://registry-direct.npmmirror.com/@gkd-kit/subscription/sync'