Merge pull request #467 from Quetzacoalt91/commits-as-jarvis #152
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: Publish images | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| list_base_images: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.set-versions.outputs.versions }} | |
| base_has_changed: ${{ steps.changes.outputs.base }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - id: set-versions | |
| run: echo "versions=$(ls base/images/ | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| base: | |
| - 'base/**' | |
| list_prestashop_images: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| versions: ${{ steps.set-versions.outputs.versions }} | |
| steps: | |
| # Fetch versions to work for images | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - id: set-versions | |
| run: echo "versions=$(./get_json_versions.py)" >> $GITHUB_OUTPUT | |
| publish_base: | |
| runs-on: ubuntu-latest | |
| needs: list_base_images | |
| strategy: | |
| matrix: | |
| version: ${{ fromJson(needs.list_base_images.outputs.versions) }} | |
| steps: | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Enable multi-platform builds | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| name: container | |
| version: latest | |
| - uses: actions/checkout@v2 | |
| - name: Base Images > Generate Tags | |
| run: ./generate_tags.sh | |
| working-directory: base | |
| - name: Base Images > Docker Build Tags | |
| run: DOCKER_REPOSITORY=${{ vars.DOCKER_BASE_REPOSITORY}} ./docker_tags.sh --version ${{ matrix.version }} | |
| if: ${{ github.event_name == 'pull_request' }} | |
| working-directory: base | |
| - name: Base Images > Docker Build & Force Push | |
| if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.list_base_images.outputs.base_has_changed == 'true' }} | |
| run: DOCKER_REPOSITORY=${{ vars.DOCKER_BASE_REPOSITORY}} ./docker_tags.sh -p -f --version ${{ matrix.version }} | |
| working-directory: base | |
| publish_prestashop: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - list_prestashop_images | |
| - publish_base | |
| - list_base_images | |
| strategy: | |
| max-parallel: 2 | |
| fail-fast: false | |
| matrix: | |
| ps-version: ${{ fromJson(needs.list_prestashop_images.outputs.versions) }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| image_has_changed: | |
| - 'images/${{ matrix.ps-version }}/**' | |
| - name: Free Disk Space (Ubuntu) | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| # this might remove tools that are actually needed, | |
| # if set to "true" but frees about 6 GB | |
| tool-cache: false | |
| # all of these default to true, but feel free to set to | |
| # "false" if necessary for your workflow | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - name: Set up QEMU | |
| if: ${{ (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Enable multi-platform builds | |
| if: ${{ (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| name: container | |
| version: latest | |
| - name: Set up Python | |
| if: ${{ (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: 3.9 | |
| - name: Install dependencies | |
| if: ${{ (needs.list_base_images.outputs.base_has_changed == 'true' || steps.filter.outputs.image_has_changed == 'true') }} | |
| run: pip install -r requirements.txt | |
| - name: Build Docker images | |
| if: ${{ steps.filter.outputs.image_has_changed == 'true' }} | |
| run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag build ${{ matrix.ps-version }} --force | |
| - name: Login to Docker Hub | |
| 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') }} | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build by using cache and push Docker images | |
| 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') }} | |
| run: DOCKER_REPOSITORY=${{ vars.DOCKER_REPOSITORY}} ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force | |