gkd-subscription/.github/workflows/release.yml
2023-09-04 21:31:42 +08:00

52 lines
1.4 KiB
YAML

name: Release
on:
push:
branches:
- 'main'
jobs:
release:
if: ${{ 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: volta-cli/action@v3
- 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/app/sync'