-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (85 loc) · 2.73 KB
/
release.yaml
File metadata and controls
99 lines (85 loc) · 2.73 KB
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
89
90
91
92
93
94
95
96
97
98
99
name: 发布发行版
on:
workflow_dispatch:
push:
branches:
- main
permissions:
contents: write
id-token: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs['packages/core--release_created'] }}
tag_name: ${{ steps.release.outputs['packages/core--tag_name'] }}
version: ${{ steps.release.outputs['packages/core--version'] }}
body: ${{ steps.release.outputs['packages/core--body'] }}
steps:
- name: 获取token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: 获取用户ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: 运行 release-please-action
id: release-please
uses: googleapis/release-please-action@v4
with:
token: ${{ steps.app-token.outputs.token }}
config-file: .release-please-config.json
manifest-file: .release-please-manifest.json
build:
needs: [release]
if: needs.release.outputs.release_created == 'true'
uses: ./.github/workflows/build.yaml
publish-to-github:
runs-on: ubuntu-latest
needs: [release, build]
if: needs.release.outputs.release_created == 'true'
steps:
- name: 导入构建产物
uses: actions/download-artifact@v4
with:
name: plugin
path: .
- name: 发布到 GitHub Release
if: needs.release.outputs.tag_name
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.tag_name }}
name: v${{ needs.release.outputs.version }}
body: ${{ needs.release.outputs.body }}
make_latest: true
- name: 发布到 GitHub Packages
id: publish-to-github
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: https://npm.pkg.github.com
access: public
provenance: true
publish-to-npm:
runs-on: ubuntu-latest
needs: [release, build]
if: needs.release.outputs.releases_created == 'true'
steps:
- name: 导入构建产物
uses: actions/download-artifact@v4
with:
name: plugin
path: ./
- name: 发布到 NPM
id: publish-to-npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
registry: https://registry.npmjs.org/
access: public
provenance: true