ci: add GitHub Actions workflows for release and CNB synchronization

This commit is contained in:
haorwen
2025-12-17 23:57:35 +08:00
parent c3ccf5a03f
commit cc07d615f3
2 changed files with 72 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
name: Release Build
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if tag is on main branch
run: |
git fetch origin main
if ! git merge-base --is-ancestor ${{ github.sha }} origin/main; then
echo "Tag is not on main branch"
exit 1
fi
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- run: pnpm install
- run: pnpm build:release
- name: Package files
run: |
cd build
zip -r ../web.vocechat.zip . -x robots.txt CNAME email.tpl.html widget_demo.html
cd ..
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
web.vocechat.zip
build/web.vocechat.md5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+21
View File
@@ -0,0 +1,21 @@
# .github/workflows/sync-cnb.yml
name: Sync to CNB
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Sync to CNB Repository
uses: docker://tencentcom/git-sync
env:
PLUGIN_TARGET_URL: "https://cnb.cool/haorwen/Privoce/vocechat-web.git"
PLUGIN_AUTH_TYPE: "https"
PLUGIN_USERNAME: "cnb"
PLUGIN_PASSWORD: ${{ secrets.CNB_TOKEN }}
PLUGIN_FORCE: "true"