11---
2- name : Publish containers
2+ name : Publish images
33
44on :
55 push :
66 branches :
77 - master
88
99jobs :
10- publish_base :
10+ list_base_images :
11+ runs-on : ubuntu-latest
12+ outputs :
13+ versions : ${{ steps.set-versions.outputs.versions }}
14+ base_has_changed : ${{ steps.changes.outputs.base }}
15+ steps :
16+ - uses : actions/checkout@v2
17+ - id : set-versions
18+ run : echo "versions=$(ls base/images/ | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
19+ - uses : dorny/paths-filter@v2
20+ id : changes
21+ with :
22+ filters : |
23+ base:
24+ - 'base/**'
25+
26+ list_prestashop_images :
1127 runs-on : ubuntu-latest
28+ outputs :
29+ versions : ${{ steps.set-versions.outputs.versions }}
1230 steps :
1331 # Fetch versions to work for images
1432 - uses : actions/checkout@v2
@@ -17,54 +35,60 @@ jobs:
1735 with :
1836 python-version : 3.8
1937 - id : set-versions
20- run : echo "::set-output name= versions:: $(./get_json_versions.py)"
38+ run : echo "versions= $(./get_json_versions.py)" >> $GITHUB_OUTPUT
2139
22- # Push image base
40+ publish_base :
41+ runs-on : ubuntu-latest
42+ needs : list_base_images
43+ strategy :
44+ matrix :
45+ manifest : ${{ fromJson(needs.list_base_images.outputs.versions) }}
46+ steps :
2347 - name : Login to Docker Hub
2448 uses : docker/login-action@v2
2549 with :
2650 username : ${{ secrets.DOCKERHUB_USERNAME }}
2751 password : ${{ secrets.DOCKERHUB_TOKEN }}
28- # # Check if there are modifications in the base/ directory
29- # # and store it in the variable `steps.changes.outputs.base`
30- # # The variable is built like: steps.{#id}.outputs.{#filter}
31- - uses : dorny/paths-filter@v2
32- id : changes
33- with :
34- filters : |
35- base:
36- - 'base/**'
52+
53+ - name : Enable multi-platform builds
54+ run : docker buildx create --name container --driver=docker-container
55+
56+ - uses : actions/checkout@v2
3757
3858 - name : Base Images > Generate Tags
3959 run : ./generate_tags.sh
4060 working-directory : base
4161
4262 - name : Base Images > Docker Build Tags
43- run : . /docker_tags.sh
63+ run : DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} . /docker_tags.sh --version ${{ matrix.version }}
4464 if : ${{ github.event_name == 'pull_request' }}
4565 working-directory : base
4666
4767 - name : Base Images > Docker Build & Force Push
48- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.changes .outputs.base == 'true' }}
49- run : . /docker_tags.sh -p -f
68+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.list_prestashop_images .outputs.base_has_changed == 'true' }}
69+ run : DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} . /docker_tags.sh -p -f --version ${{ matrix.version }}
5070 working-directory : base
51- outputs :
52- versions : ${{ steps.set-versions.outputs.versions }}
5371
54- publish_images :
72+
73+ publish_prestashop :
5574 runs-on : ubuntu-latest
56- needs : publish_base
75+ needs :
76+ - list_prestashop_images
77+ - publish_base
5778 strategy :
5879 fail-fast : false
5980 matrix :
60- ps-version : ${{ fromJson(needs.publish_base .outputs.versions) }}
81+ ps-version : ${{ fromJson(needs.list_prestashop_images .outputs.versions) }}
6182 steps :
6283 - name : Login to Docker Hub
6384 uses : docker/login-action@v2
6485 with :
6586 username : ${{ secrets.DOCKERHUB_USERNAME }}
6687 password : ${{ secrets.DOCKERHUB_TOKEN }}
6788
89+ - name : Enable multi-platform builds
90+ run : docker buildx create --name container --driver=docker-container
91+
6892 - uses : actions/checkout@v2
6993 - name : Set up Python 3.8
7094 uses : actions/setup-python@v2
7397 - name : Install dependencies
7498 run : pip install -r requirements.txt
7599
76- - name : Build Docker images
77- run : ./prestashop_docker.py --quiet tag build ${{ matrix.ps-version }} --force
78-
79- - name : Push Docker images
100+ - name : Build & Push Docker images
80101 if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
81- run : ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force
102+ run : DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force
103+
0 commit comments