gkd-subscription/.github/workflows/release.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

2023-09-04 18:11:22 +08:00
name: Release
on:
push:
branches:
- 'main'
jobs:
release:
2023-09-04 19:59:51 +08:00
if: ${{ startsWith(github.event.head_commit.message, 'chore(main):') && contains(github.event.head_commit.message, 'release') }}
2023-09-04 18:11:22 +08:00
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
2023-09-04 19:59:51 +08:00
- run: pnpm run build
2023-09-04 18:11:22 +08:00
- 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
2023-09-04 21:10:01 +08:00
git status
2023-09-04 18:11:22 +08:00
git add .
2023-09-04 21:10:01 +08:00
git commit -m "build: json,readme" -a
2023-09-04 18:11:22 +08:00
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 }}
2023-09-04 19:25:02 +08:00
- name: Publish package
2023-09-04 19:59:51 +08:00
if: ${{ steps.commit.outcome == 'success' }}
2023-09-04 19:25:02 +08:00
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
2023-09-04 19:30:49 +08:00
pnpm publish
2023-09-04 21:31:22 +08:00
- name: sync npmmirror
2023-09-14 17:13:14 +08:00
run: curl -X PUT 'https://registry-direct.npmmirror.com/@gkd-kit/subscription/sync'