|
|
|
@ -1,38 +1,27 @@
|
|
|
|
|
name: Build and Push Base Image
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
push:
|
|
|
|
|
pull_request:
|
|
|
|
|
branches:
|
|
|
|
|
- 'pr*'
|
|
|
|
|
- 'dev'
|
|
|
|
|
- 'v*'
|
|
|
|
|
paths:
|
|
|
|
|
- poetry.lock
|
|
|
|
|
- pyproject.toml
|
|
|
|
|
- Dockerfile-base
|
|
|
|
|
- package.json
|
|
|
|
|
- go.mod
|
|
|
|
|
- yarn.lock
|
|
|
|
|
- pom.xml
|
|
|
|
|
- install_deps.sh
|
|
|
|
|
types:
|
|
|
|
|
- opened
|
|
|
|
|
- synchronize
|
|
|
|
|
- reopened
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
check-deps-change:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
outputs:
|
|
|
|
|
should_skip: ${{ steps.set_skip_flag.outputs.should_skip }} # 输出 should_skip 标志
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout code
|
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
with:
|
|
|
|
|
fetch-depth: 0 # 确保检出完整历史
|
|
|
|
|
|
|
|
|
|
- name: Fetch all branches
|
|
|
|
|
run: git fetch --all # 拉取所有分支
|
|
|
|
|
|
|
|
|
|
- name: Check conditions
|
|
|
|
|
id: set_skip_flag
|
|
|
|
|
run: |
|
|
|
|
|
if git diff --name-only HEAD^ HEAD | grep -E 'poetry.lock|pyproject.toml|Dockerfile-base|package.json|go.mod|yarn.lock|pom.xml|install_deps.sh';then
|
|
|
|
|
echo "Found deps file changes"
|
|
|
|
|
else
|
|
|
|
|
echo "Not found deps file changes, skip build"
|
|
|
|
|
echo "::set-output name=should_skip::true" # 根据条件设置输出
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
build-and-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
needs: check-deps-change # 依赖 check_skip job 的执行结果
|
|
|
|
|
if: needs.check-deps-change.outputs.should_skip != 'true'
|
|
|
|
|
steps:
|
|
|
|
|
- name: Checkout repository
|
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|