This commit is contained in:
shanshanzhong 2025-09-25 08:55:12 -07:00
parent 02fc54df21
commit fcfd2a9a9f
2 changed files with 42 additions and 3 deletions

View File

@ -11,6 +11,9 @@ on:
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:
@ -54,3 +57,35 @@ jobs:
- 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 }}

View File

@ -46,14 +46,14 @@ push: push-admin push-user ## Push both admin and user images to the registry
.PHONY: push-admin
push-admin: ## Push the admin image to the registry
@echo "Pushing admin image..."
@echo "Pushing admin image ${ADMIN_IMAGE}:${VERSION} and ${ADMIN_IMAGE}:latest..."
docker push ${ADMIN_IMAGE}:${VERSION}
docker push ${ADMIN_IMAGE}:latest
@echo "Successfully pushed admin image."
.PHONY: push-user
push-user: ## Push the user image to the registry
@echo "Pushing user image..."
@echo "Pushing user image ${USER_IMAGE}:${VERSION} and ${USER_IMAGE}:latest..."
docker push ${USER_IMAGE}:${VERSION}
docker push ${USER_IMAGE}:latest
@echo "Successfully pushed user image."
@ -72,4 +72,8 @@ help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@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}"