Skip to content

Commit 7a61746

Browse files
authored
Update deploy.yml
1 parent ef5b738 commit 7a61746

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ on:
44
push:
55
branches:
66
- source
7-
# 如果你想要进一步定义触发条件、路径等,可以查看文档
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
97

108
jobs:
119
deploy:
1210
name: Deploy to GitHub Pages
1311
runs-on: ubuntu-latest
1412
steps:
1513
- uses: actions/checkout@v2
14+
1615
- uses: actions/setup-node@v3
1716
with:
1817
node-version: 18
@@ -21,29 +20,21 @@ jobs:
2120

2221
- name: Install dependencies
2322
run: npm ci
24-
- name: create en
23+
24+
- name: Create en translation
2525
run: npm run write-translations -- --locale en
26-
# - name: crowdin
27-
# env:
28-
# CROWDIN_PERSONAL_TOKEN: ${{secrets.CROWDIN_PERSONAL_TOKEN}}
29-
# run: npm run crowdin:sync
26+
3027
- name: Build website
3128
run: npm run build
29+
3230
- name: Compress build output
3331
run: tar -czf build.tar.gz -C build .
34-
# 部署到 GitHub Pages 的热门选择:
35-
# 文档:https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
32+
3633
- name: Deploy to GitHub Pages
3734
uses: peaceiris/actions-gh-pages@v3
3835
with:
3936
github_token: ${{ secrets.GITHUB_TOKEN }}
40-
# 要发布到 `gh-pages` 分支的构建输出:
4137
publish_dir: ./build
42-
# 下面两行会将此次部署 commit 的作者设置为官方的
43-
# GH-Actions 机器人:
44-
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
45-
# 如果不设置这两个字段,GH actions 机器人会被默认使用。
46-
# 你可以用自己的用户信息替换它们。
4738
user_name: hezhuozhuo
4839
user_email: 421045249@qq.com
4940

@@ -61,3 +52,20 @@ jobs:
6152
tar -xzf build.tar.gz -C /srv/thingspanel.io/html/
6253
rm build.tar.gz
6354
/usr/bin/podman restart thingspanel.io
55+
56+
- name: Install GitHub CLI
57+
run: |
58+
sudo apt update
59+
sudo apt install -y gh
60+
61+
- name: Delete existing latest release (if exists)
62+
run: |
63+
gh release delete latest --yes || echo "No existing latest release"
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Create new latest release
68+
run: |
69+
gh release create latest build.tar.gz --title "Latest Release" --notes "Auto-generated release from GitHub Actions"
70+
env:
71+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)