Replace direct path filtering in workflows with dorny/paths-filter …
#15
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: Build & Push Multi-Arch Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_run: ${{ steps.filter.outputs.src }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| src: | |
| - 'Datasets/**' | |
| - 'Datasets' | |
| - '.github/workflows/docker.yml' | |
| - 'app.py' | |
| - 'Dockerfile' | |
| - 'requirements.txt' | |
| - 'templates/**' | |
| - 'static/**' | |
| - 'models/**' | |
| - 'scripts/**' | |
| - 'fit.py' | |
| - '.dockerignore' | |
| docker-build: | |
| needs: changes | |
| if: ${{ needs.changes.outputs.should_run == 'true' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU for multi-arch builds | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push multi-arch image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: bytebard101/cosmoclassifier:latest |