tg
This commit is contained in:
parent
fcfd2a9a9f
commit
ea16dbb91d
@ -52,11 +52,51 @@ jobs:
|
|||||||
- name: Install dependencies (bun)
|
- name: Install dependencies (bun)
|
||||||
run: bun install
|
run: bun install
|
||||||
|
|
||||||
- name: Run Build Project (turbo via bun)
|
- name: Decide build target (admin/user/both)
|
||||||
run: bun run build
|
run: |
|
||||||
|
set -e
|
||||||
|
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
||||||
|
BUILD_TARGET="both"
|
||||||
|
if echo "$COMMIT_MSG" | grep -qi "\[admin-only\]"; then
|
||||||
|
BUILD_TARGET="admin"
|
||||||
|
elif echo "$COMMIT_MSG" | grep -qi "\[user-only\]"; then
|
||||||
|
BUILD_TARGET="user"
|
||||||
|
else
|
||||||
|
if git rev-parse HEAD^ >/dev/null 2>&1; then
|
||||||
|
RANGE="HEAD^..HEAD"
|
||||||
|
else
|
||||||
|
RANGE="$(git rev-list --max-parents=0 HEAD)..HEAD"
|
||||||
|
fi
|
||||||
|
CHANGED=$(git diff --name-only $RANGE || true)
|
||||||
|
ADMIN_MATCH=$(echo "$CHANGED" | grep -E '^(apps/admin/|docker/ppanel-admin-web/)' || true)
|
||||||
|
USER_MATCH=$(echo "$CHANGED" | grep -E '^(apps/user/|docker/ppanel-user-web/)' || true)
|
||||||
|
PACKAGE_MATCH=$(echo "$CHANGED" | grep -E '^(packages/|turbo.json|package.json|bun.lock)' || true)
|
||||||
|
if [ -n "$PACKAGE_MATCH" ]; then
|
||||||
|
BUILD_TARGET="both"
|
||||||
|
else
|
||||||
|
if [ -n "$ADMIN_MATCH" ] && [ -z "$USER_MATCH" ]; then BUILD_TARGET="admin"; fi
|
||||||
|
if [ -n "$USER_MATCH" ] && [ -z "$ADMIN_MATCH" ]; then BUILD_TARGET="user"; fi
|
||||||
|
if [ -n "$ADMIN_MATCH" ] && [ -n "$USER_MATCH" ]; then BUILD_TARGET="both"; fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "BUILD_TARGET=$BUILD_TARGET" >> $GITHUB_ENV
|
||||||
|
echo "Decided BUILD_TARGET=$BUILD_TARGET"
|
||||||
|
|
||||||
- name: Run Build Docker
|
- name: Build Admin (turbo via bun)
|
||||||
run: make build
|
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
|
||||||
|
run: bun run build --filter=apps/admin
|
||||||
|
|
||||||
|
- name: Build User (turbo via bun)
|
||||||
|
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
|
||||||
|
run: bun run build --filter=apps/user
|
||||||
|
|
||||||
|
- name: Build Docker (admin)
|
||||||
|
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
|
||||||
|
run: make build-admin
|
||||||
|
|
||||||
|
- name: Build Docker (user)
|
||||||
|
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
|
||||||
|
run: make build-user
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
- name: Login to Docker Registry
|
||||||
env:
|
env:
|
||||||
@ -65,8 +105,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login "$DOCKER_REGISTRY" -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|
||||||
- name: Push Docker Images
|
- name: Push Docker Image (admin)
|
||||||
run: make push
|
if: env.BUILD_TARGET == 'admin' || env.BUILD_TARGET == 'both'
|
||||||
|
run: make push-admin
|
||||||
|
|
||||||
|
- name: Push Docker Image (user)
|
||||||
|
if: env.BUILD_TARGET == 'user' || env.BUILD_TARGET == 'both'
|
||||||
|
run: make push-user
|
||||||
|
|
||||||
- name: Notify success to Telegram
|
- name: Notify success to Telegram
|
||||||
uses: chapvic/telegram-notify@master
|
uses: chapvic/telegram-notify@master
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user