Merge pull request #18 from persys-dev/NEW-AGENT-WORKLOAD-SCHEDULER #128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: docker image CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - 'infra/**/*' | |
| - 'hack/**/*' | |
| - 'docs/**/*' | |
| - 'clients/**/*' | |
| - 'build/**/*' | |
| - '*.md' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper change detection | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Build and Deploy | |
| run: | | |
| # Get the list of changed files | |
| CHANGED_FILES=$(git diff --name-only HEAD^ HEAD) | |
| # Function to build Docker image | |
| build_image() { | |
| local service=$1 | |
| local dir=$2 | |
| echo "Building $service..." | |
| cd $dir | |
| docker build -t $service:$(date +%s) . | |
| cd ../.. | |
| } | |
| # Check each service directory for changes | |
| if echo "$CHANGED_FILES" | grep -q "^persys-gateway/"; then | |
| build_image "api-gateway" "persys-gateway" | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q "^persys-scheduler/"; then | |
| build_image "persys-scheduler" "persys-scheduler" | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q "^persys-federation/"; then | |
| build_image "persys-federation" "persys-federation" | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q "^persys-forgery/"; then | |
| build_image "persys-forgery" "persys-forgery" | |
| fi | |
| if echo "$CHANGED_FILES" | grep -q "^persys-cfssl/"; then | |
| build_image "persys-cfssl" "persys-cfssl" | |
| fi | |
| - name: List built images | |
| run: docker images |