Skip to content

Commit 426a487

Browse files
committed
ci: upload sdk theme release asset
1 parent 1498c02 commit 426a487

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/publish-theme.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name: 发布 npm 公共包
1+
name: 发布主题包
22

33
on:
44
release:
55
types: [published]
66
workflow_dispatch:
77

88
permissions:
9-
contents: read
9+
contents: write
1010

1111
jobs:
1212
publish:
@@ -38,8 +38,26 @@ jobs:
3838
working-directory: theme
3939
run: pnpm pack --dry-run
4040

41-
- name: 发布包
41+
- name: 打包 Release 资产
42+
working-directory: theme
43+
run: |
44+
mkdir -p ../dist
45+
pnpm pack --pack-destination ../dist
46+
mv ../dist/doudou-start-airgate-theme-*.tgz "../dist/airgate-theme-${GITHUB_REF_NAME}.tgz"
47+
48+
- name: 上传 GitHub Release 资产
49+
if: github.event_name == 'release'
50+
env:
51+
GH_TOKEN: ${{ github.token }}
52+
run: gh release upload "${GITHUB_REF_NAME}" "dist/airgate-theme-${GITHUB_REF_NAME}.tgz" --clobber
53+
54+
- name: 发布 npm 包
4255
working-directory: theme
43-
run: pnpm publish --access public --no-git-checks
4456
env:
4557
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
58+
run: |
59+
if [ -z "$NODE_AUTH_TOKEN" ]; then
60+
echo "NPM_TOKEN 未配置,跳过 npm publish"
61+
exit 0
62+
fi
63+
pnpm publish --access public --no-git-checks

0 commit comments

Comments
 (0)