Skip to content

Commit 989f07e

Browse files
committed
Build only PrestaShop if they or their base have been modified
1 parent ef45571 commit 989f07e

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

.github/workflows/publish.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v2
1717
- id: set-versions
1818
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
2020
id: changes
2121
with:
2222
filters: |
@@ -81,42 +81,56 @@ jobs:
8181
needs:
8282
- list_prestashop_images
8383
- publish_base
84+
- list_base_images
8485
strategy:
8586
max-parallel: 2
8687
fail-fast: false
8788
matrix:
8889
ps-version: ${{ fromJson(needs.list_prestashop_images.outputs.versions) }}
8990
steps:
91+
- uses: actions/checkout@v2
92+
93+
- uses: dorny/paths-filter@v3
94+
id: filter
95+
with:
96+
base: HEAD
97+
filters: |
98+
image_has_changed:
99+
- 'images/${{ matrix.ps-version }}/**'
100+
90101
- name: Set up QEMU
102+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
91103
uses: docker/setup-qemu-action@v3
92104

93105
- name: Enable multi-platform builds
106+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
94107
uses: docker/setup-buildx-action@v3
95108
with:
96109
name: container
97110
version: latest
98111

99-
- uses: actions/checkout@v2
100-
101112
- name: Set up Python
113+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
102114
uses: actions/setup-python@v2
103115
with:
104116
python-version: 3.9
105117

106118
- name: Install dependencies
119+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
107120
run: pip install -r requirements.txt
108121

109122
- name: Build Docker images
110-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
123+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
111124
run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag build ${{ matrix.ps-version }} --force
112125

113126
- name: Login to Docker Hub
127+
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') }}
114128
uses: docker/login-action@v2
115129
with:
116130
username: ${{ secrets.DOCKERHUB_USERNAME }}
117131
password: ${{ secrets.DOCKERHUB_TOKEN }}
118132

119133
- name: Build by using cache and push Docker images
120-
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
134+
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') }}
121135
run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force
122136

0 commit comments

Comments
 (0)