2023-11-05 02:03:27 +08:00
|
|
|
name: build_release
|
2023-09-04 18:11:22 +08:00
|
|
|
|
2023-11-05 02:03:27 +08:00
|
|
|
on: workflow_dispatch
|
2023-09-04 18:11:22 +08:00
|
|
|
|
|
|
|
jobs:
|
2023-11-05 02:03:27 +08:00
|
|
|
build_release:
|
2023-09-04 18:11:22 +08:00
|
|
|
runs-on: ubuntu-latest
|
2023-11-05 02:03:27 +08:00
|
|
|
outputs:
|
|
|
|
version: ${{ steps.version.outputs.version }}
|
2023-09-04 18:11:22 +08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-09-22 20:51:33 +08:00
|
|
|
- uses: actions/setup-node@v3
|
2023-09-20 23:21:36 +08:00
|
|
|
with:
|
2023-09-22 20:51:33 +08:00
|
|
|
node-version: 20
|
2023-09-20 00:12:17 +08:00
|
|
|
|
2023-09-04 18:11:22 +08:00
|
|
|
- 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
|
|
|
|
2023-11-05 02:03:27 +08:00
|
|
|
- id: version
|
|
|
|
run: |
|
2023-11-05 19:08:52 +08:00
|
|
|
version=$(pnpm exec tsx ./scripts/showVersion.ts)
|
2023-11-05 02:03:27 +08:00
|
|
|
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
|
|
|
|
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-11-05 02:03:27 +08:00
|
|
|
git commit -a -m "chore: v${{steps.version.outputs.version}}"
|
2023-09-04 18:11:22 +08:00
|
|
|
continue-on-error: true
|
|
|
|
|
|
|
|
- name: Git push
|
|
|
|
if: ${{ steps.commit.outcome == 'success' }}
|
2023-11-05 02:03:27 +08:00
|
|
|
uses: ad-m/github-push-action@master
|
2023-09-04 18:11:22 +08:00
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
branch: ${{ github.ref }}
|
2023-11-05 02:03:27 +08:00
|
|
|
tags: true
|
|
|
|
|
|
|
|
- name: Create Release
|
|
|
|
if: ${{ steps.commit.outcome == 'success' }}
|
|
|
|
uses: actions/create-release@v1
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
2023-11-06 12:15:30 +08:00
|
|
|
tag_name: v${{ steps.version.outputs.version }}
|
2023-11-05 02:03:27 +08:00
|
|
|
release_name: Release ${{ steps.version.outputs.version }}
|
2023-11-28 21:24:30 +08:00
|
|
|
body_path: ./CHANGELOG.md
|
2023-09-04 18:11:22 +08:00
|
|
|
|
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-11-05 02:03:27 +08:00
|
|
|
if: ${{ steps.commit.outcome == 'success' }}
|
2023-09-14 17:13:14 +08:00
|
|
|
run: curl -X PUT 'https://registry-direct.npmmirror.com/@gkd-kit/subscription/sync'
|