-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (75 loc) · 2.79 KB
/
build_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: build_release
on: workflow_dispatch
jobs:
build_release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4.2.1
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4.0.0
with:
version: latest
run_install: true
- uses: actions/setup-node@v4.0.4
with:
node-version: lts/*
cache: pnpm
- run: pnpm run build
- id: version
run: |
version=$(node -e "import('@gkd-kit/tools').then((m) => m.stdoutGkdVersion());")
echo "version=${version}" >> "$GITHUB_OUTPUT"
- id: update_pkg_version
run: node -e "import('@gkd-kit/tools').then((m) => m.updatePkgVersion());"
- 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 status
git add .
git commit -a -m "chore: v${{steps.version.outputs.version}}"
continue-on-error: true
- name: Git push
if: ${{ steps.commit.outcome == 'success' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Create Release
id: create_release
if: ${{ steps.commit.outcome == 'success' }}
uses: actions/create-release@v1.1.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
body_path: ./dist/CHANGELOG.md
- name: Upload Release
if: ${{ steps.commit.outcome == 'success' }}
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/gkd.json5
asset_name: gkd_${{ steps.version.outputs.version }}.json5
asset_content_type: application/json
- name: Publish package
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.commit.outcome == 'success' && env.NPM_TOKEN != '' }}
run: |
pnpm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm publish --no-git-checks
node -e "import('@gkd-kit/tools').then((m) => m.syncNpmmirror());"
- name: sync
if: ${{ steps.commit.outcome == 'success' }}
run: |
curl -X PUT 'https://registry-direct.npmmirror.com/gkd-subscription/sync'
curl -X PUT 'https://purge.jsdelivr.net/npm/gkd-subscription/dist'