Compare commits

...

7 Commits
main ... dev

Author SHA1 Message Date
xpcool-bot
05bb399321 fix(docker): bundle manifest/config into image
All checks were successful
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Successful in 56s
2026-08-25 00:09:44 +08:00
xpcool-bot
2c8d7f362e ci: retry deploy
All checks were successful
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Successful in 1m0s
2026-08-25 00:06:57 +08:00
xpcool-bot
364d9feeb1 ci: trigger first deploy
Some checks failed
Build and Deploy (service.xpcool.com) / build-and-deploy (push) Failing after 0s
2026-08-25 00:02:07 +08:00
xpcool-bot
eb519e3265 ci: tweak comment v3 2026-08-24 23:56:45 +08:00
xpcool-bot
fda44c1025 ci: tweak comment v2 2026-08-24 23:55:28 +08:00
xpcool-bot
f318d0d35b ci: tweak workflow comment 2026-08-24 23:54:19 +08:00
xpcool-bot
2637e62f3f ci: add build & docker deploy workflow with notification 2026-08-24 23:49:02 +08:00
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,63 @@
# deployed by gitea act_runner - trigger on push v5
name: Build and Deploy (service.xpcool.com)
on:
push:
branches: [main, dev]
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: Install Go 1.23
run: |
curl -fsSL https://mirrors.aliyun.com/golang/go1.23.0.linux-amd64.tar.gz -o /tmp/go.tgz
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/go.tgz
/usr/local/go/bin/go version
- name: Build (linux/amd64)
env:
GOPROXY: https://goproxy.cn,direct
run: |
export PATH=$PATH:/usr/local/go/bin
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o temp/linux_amd64/main .
- name: Docker build & deploy
run: |
docker build -f manifest/docker/Dockerfile -t service.xpcool.com:latest .
docker rm -f service.xpcool.com 2>/dev/null || true
docker run -d \
--name service.xpcool.com \
--restart unless-stopped \
--network xpcool-net \
-p 127.0.0.1:8000:8000 \
-e DB_DSN="${{ secrets.DB_DSN }}" \
-e JWT_SECRET="${{ secrets.JWT_SECRET }}" \
service.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":"✅ 部署成功 service.xpcool.com","content":"仓库: ${{ github.repository }}<br>分支: ${{ github.ref_name }}<br>提交: ${{ github.sha }}<br>触发人: ${{ github.actor }}<br>状态: 编译打包部署成功<br>访问: https://service.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":"❌ 部署失败 service.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"}'

View File

@ -6,8 +6,11 @@ FROM loads/alpine:3.8
ENV WORKDIR /app ENV WORKDIR /app
ADD resource $WORKDIR/ ADD resource $WORKDIR/
ADD manifest/config $WORKDIR/manifest/config
ADD ./temp/linux_amd64/main $WORKDIR/main ADD ./temp/linux_amd64/main $WORKDIR/main
RUN chmod +x $WORKDIR/main RUN chmod +x $WORKDIR/main
# GoFrame 默认加载 config.yaml这里把生产配置作为默认配置
RUN cp $WORKDIR/manifest/config/config.prod.yaml $WORKDIR/manifest/config/config.yaml
############################################################################### ###############################################################################
# START # START