|
16 | 16 | - uses: actions/checkout@v2 |
17 | 17 | - id: set-versions |
18 | 18 | run: echo "versions=$(ls base/images/ | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT |
19 | | - - uses: dorny/paths-filter@v2 |
| 19 | + - uses: dorny/paths-filter@v3 |
20 | 20 | id: changes |
21 | 21 | with: |
22 | 22 | filters: | |
@@ -81,42 +81,55 @@ jobs: |
81 | 81 | needs: |
82 | 82 | - list_prestashop_images |
83 | 83 | - publish_base |
| 84 | + - list_base_images |
84 | 85 | strategy: |
85 | 86 | max-parallel: 2 |
86 | 87 | fail-fast: false |
87 | 88 | matrix: |
88 | 89 | ps-version: ${{ fromJson(needs.list_prestashop_images.outputs.versions) }} |
89 | 90 | steps: |
| 91 | + - uses: actions/checkout@v2 |
| 92 | + |
| 93 | + - uses: dorny/paths-filter@v3 |
| 94 | + id: filter |
| 95 | + with: |
| 96 | + filters: | |
| 97 | + image_has_changed: |
| 98 | + - 'images/${{ matrix.ps-version }}/**' |
| 99 | +
|
90 | 100 | - name: Set up QEMU |
| 101 | + if: ${{ steps.filter.outputs.image_has_changed == 'true' }} |
91 | 102 | uses: docker/setup-qemu-action@v3 |
92 | 103 |
|
93 | 104 | - name: Enable multi-platform builds |
| 105 | + if: ${{ steps.filter.outputs.image_has_changed == 'true' }} |
94 | 106 | uses: docker/setup-buildx-action@v3 |
95 | 107 | with: |
96 | 108 | name: container |
97 | 109 | version: latest |
98 | 110 |
|
99 | | - - uses: actions/checkout@v2 |
100 | | - |
101 | 111 | - name: Set up Python |
| 112 | + if: ${{ steps.filter.outputs.image_has_changed == 'true' }} |
102 | 113 | uses: actions/setup-python@v2 |
103 | 114 | with: |
104 | 115 | python-version: 3.9 |
105 | 116 |
|
106 | 117 | - name: Install dependencies |
| 118 | + if: ${{ steps.filter.outputs.image_has_changed == 'true' }} |
107 | 119 | run: pip install -r requirements.txt |
108 | 120 |
|
109 | 121 | - name: Build Docker images |
110 | | - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 122 | + if: ${{ steps.filter.outputs.image_has_changed == 'true' }} |
111 | 123 | run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag build ${{ matrix.ps-version }} --force |
112 | 124 |
|
113 | 125 | - name: Login to Docker Hub |
| 126 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} |
114 | 127 | uses: docker/login-action@v2 |
115 | 128 | with: |
116 | 129 | username: ${{ secrets.DOCKERHUB_USERNAME }} |
117 | 130 | password: ${{ secrets.DOCKERHUB_TOKEN }} |
118 | 131 |
|
119 | 132 | - name: Build by using cache and push Docker images |
120 | | - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 133 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} |
121 | 134 | run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force |
122 | 135 |
|
0 commit comments