Workflow config file is invalid. Please check your config file: yaml: line 79: mapping values are not allowed in this context
2025-09-25 08:55:12 -07:00

92 lines
2.7 KiB
YAML

name: CI
on:
push:
branches:
- cicd
pull_request:
branches:
- cicd
env:
DOMAIN_URL: git.kxsw.us #*修改为你
REPO: ${{ vars.REPO }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
DOCKER_REGISTRY: registry.kxsw.us
jobs:
build:
runs-on: ppanel-web01
container:
image: node:20
strategy:
matrix:
# 只有node支持版本号别名
node: ['20.15.1']
steps:
- name: Checkout code
uses: https://gitea.cn/actions/checkout@v4
- name: Install system tools (jq, docker, curl)
run: |
apt-get update
apt-get install -y jq curl ca-certificates docker.io
docker --version
jq --version
curl --version
- name: Install Bun
run: |
curl -fsSL https://bun.sh/install | bash
echo "BUN_INSTALL=/root/.bun" >> $GITHUB_ENV
echo "PATH=/root/.bun/bin:${PATH}" >> $GITHUB_ENV
/root/.bun/bin/bun --version
- name: Configure npm registry (npmmirror) and canvas mirror
run: |
echo "registry=https://registry.npmmirror.com" >> .npmrc
echo "canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas" >> .npmrc
- name: Install dependencies (bun)
run: bun install
- name: Run Build Project (turbo via bun)
run: bun run build
- name: Run Build Docker
run: make build
- name: Login to Docker Registry
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
- name: Push Docker Images
run: make push
- name: Notify success to Telegram
uses: chapvic/telegram-notify@master
if: success()
with:
token: ${{ env.TELEGRAM_BOT_TOKEN }}
chat: ${{ env.TELEGRAM_CHAT_ID }}
status: ${{ job.status }}
title: ✅ 构建成功
message: ${{ github.repository }} 构建成功 · 分支: ${{ github.ref }} · 提交: ${{ github.sha }}
footer: 触发者: ${{ github.actor }}
- name: Notify failure to Telegram
uses: chapvic/telegram-notify@master
if: failure()
with:
token: ${{ env.TELEGRAM_BOT_TOKEN }}
chat: ${{ env.TELEGRAM_CHAT_ID }}
status: ${{ job.status }}
title: ❌ 构建失败
message: ${{ github.repository }} 构建失败 · 分支: ${{ github.ref }} · 提交: ${{ github.sha }}
footer: 触发者: ${{ github.actor }}