Skip to content

Commit 7a78eb6

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

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/publish.yml

Lines changed: 18 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,55 @@ 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+
filters: |
97+
image_has_changed:
98+
- 'images/${{ matrix.ps-version }}/**'
99+
90100
- name: Set up QEMU
101+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
91102
uses: docker/setup-qemu-action@v3
92103

93104
- name: Enable multi-platform builds
105+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
94106
uses: docker/setup-buildx-action@v3
95107
with:
96108
name: container
97109
version: latest
98110

99-
- uses: actions/checkout@v2
100-
101111
- name: Set up Python
112+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
102113
uses: actions/setup-python@v2
103114
with:
104115
python-version: 3.9
105116

106117
- name: Install dependencies
118+
if: ${{ steps.filter.outputs.image_has_changed == 'true' }}
107119
run: pip install -r requirements.txt
108120

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

113125
- 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') }}
114127
uses: docker/login-action@v2
115128
with:
116129
username: ${{ secrets.DOCKERHUB_USERNAME }}
117130
password: ${{ secrets.DOCKERHUB_TOKEN }}
118131

119132
- 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') }}
121134
run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force
122135

0 commit comments

Comments
 (0)