Compare commits
No commits in common. "2b24a66dbceac0af550d8264006ad1ba7e59298b" and "f3113d787d1be7c5a6bb79f509db9fdb9f9fda02" have entirely different histories.
2b24a66dbc
...
f3113d787d
@ -9,15 +9,12 @@ on:
|
|||||||
- cicd
|
- cicd
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOMAIN_URL: git.kxsw.us #*修改为你1
|
DOMAIN_URL: git.kxsw.us #*修改为你
|
||||||
REPO: ${{ vars.REPO }}
|
REPO: ${{ vars.REPO }}
|
||||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
|
||||||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
|
||||||
DOCKER_REGISTRY: registry.kxsw.us
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ppanel-web02
|
runs-on: ppanel-web01
|
||||||
container:
|
container:
|
||||||
image: node:20
|
image: node:20
|
||||||
strategy:
|
strategy:
|
||||||
@ -29,56 +26,11 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: https://gitea.cn/actions/checkout@v4
|
uses: https://gitea.cn/actions/checkout@v4
|
||||||
|
|
||||||
- name: Install system tools (jq, docker, curl)
|
- id: tool-cache
|
||||||
run: |
|
uses: https://${{ vars.GIT_USERNAME }}:${{ vars.GIT_PASSWORD }}@${{ env.DOMAIN_URL }}/actions/gitea-tool-cache@v5
|
||||||
apt-get update
|
with:
|
||||||
apt-get install -y jq curl ca-certificates docker.io
|
# 只有node支持版本号别名
|
||||||
docker --version
|
node-version: lts
|
||||||
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
|
- name: Run Build Docker
|
||||||
run: make build
|
run: make build
|
||||||
|
|
||||||
- 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 }} · 提1交: ${{ 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 }}
|
|
||||||
|
|||||||
8
Makefile
8
Makefile
@ -46,14 +46,14 @@ push: push-admin push-user ## Push both admin and user images to the registry
|
|||||||
|
|
||||||
.PHONY: push-admin
|
.PHONY: push-admin
|
||||||
push-admin: ## Push the admin image to the registry
|
push-admin: ## Push the admin image to the registry
|
||||||
@echo "Pushing admin image ${ADMIN_IMAGE}:${VERSION} and ${ADMIN_IMAGE}:latest..."
|
@echo "Pushing admin image..."
|
||||||
docker push ${ADMIN_IMAGE}:${VERSION}
|
docker push ${ADMIN_IMAGE}:${VERSION}
|
||||||
docker push ${ADMIN_IMAGE}:latest
|
docker push ${ADMIN_IMAGE}:latest
|
||||||
@echo "Successfully pushed admin image."
|
@echo "Successfully pushed admin image."
|
||||||
|
|
||||||
.PHONY: push-user
|
.PHONY: push-user
|
||||||
push-user: ## Push the user image to the registry
|
push-user: ## Push the user image to the registry
|
||||||
@echo "Pushing user image ${USER_IMAGE}:${VERSION} and ${USER_IMAGE}:latest..."
|
@echo "Pushing user image..."
|
||||||
docker push ${USER_IMAGE}:${VERSION}
|
docker push ${USER_IMAGE}:${VERSION}
|
||||||
docker push ${USER_IMAGE}:latest
|
docker push ${USER_IMAGE}:latest
|
||||||
@echo "Successfully pushed user image."
|
@echo "Successfully pushed user image."
|
||||||
@ -73,7 +73,3 @@ help: ## Show this help message
|
|||||||
@echo ""
|
@echo ""
|
||||||
@echo "Targets:"
|
@echo "Targets:"
|
||||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||||
|
|
||||||
.PHONY: version
|
|
||||||
version: ## Print project version from package.json
|
|
||||||
@echo "${VERSION}"
|
|
||||||
Loading…
x
Reference in New Issue
Block a user