Some checks failed
Build and Deploy (admin.xpcool.com) / build-and-deploy (push) Failing after 1m0s
50 lines
2.4 KiB
YAML
50 lines
2.4 KiB
YAML
# deployed by gitea act_runner (push to main triggers this)
|
||
name: Build and Deploy (admin.xpcool.com)
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
build-and-deploy:
|
||
runs-on: ubuntu-latest
|
||
steps:
|
||
- name: Install git & docker CLI
|
||
run: |
|
||
sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g; s|security.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list 2>/dev/null || true
|
||
sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g; s|security.debian.org|mirrors.cloud.tencent.com|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null || true
|
||
apt-get update
|
||
apt-get install -y git docker.io
|
||
|
||
- name: Checkout (local Gitea)
|
||
run: |
|
||
git clone --depth 1 --branch "${{ github.ref_name }}" https://oauth2:${{ github.token }}@git.xpcool.com/${{ github.repository }}.git .
|
||
git checkout ${{ github.sha }}
|
||
|
||
- name: Docker build & deploy
|
||
run: |
|
||
# .npmrc 里的 store-dir 是 Windows 路径,Linux 容器里会导致 pnpm 异常,临时移除
|
||
sed -i '/store-dir=/d' .npmrc
|
||
docker build -f scripts/deploy/Dockerfile -t admin.xpcool.com:latest .
|
||
docker rm -f admin.xpcool.com 2>/dev/null || true
|
||
docker run -d \
|
||
--name admin.xpcool.com \
|
||
--restart unless-stopped \
|
||
-p 127.0.0.1:8010:8080 \
|
||
admin.xpcool.com:latest
|
||
|
||
- name: Notify success (PushPlus)
|
||
if: success()
|
||
run: |
|
||
curl -s -X POST "https://www.pushplus.plus/send" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"token":"${{ secrets.PUSHPLUS_TOKEN }}","title":"✅ 部署成功 admin.xpcool.com","content":"仓库: ${{ github.repository }}<br>分支: ${{ github.ref_name }}<br>提交: ${{ github.sha }}<br>触发人: ${{ github.actor }}<br>状态: 编译打包部署成功<br>访问: https://admin.xpcool.com","template":"html"}'
|
||
|
||
- name: Notify failure (PushPlus)
|
||
if: failure()
|
||
run: |
|
||
curl -s -X POST "https://www.pushplus.plus/send" \
|
||
-H "Content-Type: application/json" \
|
||
-d '{"token":"${{ secrets.PUSHPLUS_TOKEN }}","title":"❌ 部署失败 admin.xpcool.com","content":"仓库: ${{ github.repository }}<br>分支: ${{ github.ref_name }}<br>提交: ${{ github.sha }}<br>触发人: ${{ github.actor }}<br>状态: 构建或部署失败<br>日志: https://git.xpcool.com/${{ github.repository }}/actions","template":"html"}'
|