Merge pull request #403 from PrestaShop/fix-90x-docker #108
This file contains 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 containers | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
publish_base: | |
runs-on: ubuntu-latest | |
steps: | |
# Fetch versions to work for images | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- id: set-versions | |
run: echo "::set-output name=versions::$(./get_json_versions.py)" | |
# Push image base | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
## Check if there are modifications in the base/ directory | |
## and store it in the variable `steps.changes.outputs.base` | |
## The variable is built like: steps.{#id}.outputs.{#filter} | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
base: | |
- 'base/**' | |
- name: Base Images > Generate Tags | |
run: ./generate_tags.sh | |
working-directory: base | |
- name: Base Images > Docker Build Tags | |
run: ./docker_tags.sh | |
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' && steps.changes.outputs.base == 'true' }} | |
run: ./docker_tags.sh -p -f | |
working-directory: base | |
outputs: | |
versions: ${{ steps.set-versions.outputs.versions }} | |
publish_images: | |
runs-on: ubuntu-latest | |
needs: publish_base | |
strategy: | |
fail-fast: false | |
matrix: | |
ps-version: ${{ fromJson(needs.publish_base.outputs.versions) }} | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Build Docker images | |
run: ./prestashop_docker.py --quiet tag build ${{ matrix.ps-version }} --force | |
- name: Push Docker images | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
run: ./prestashop_docker.py --quiet tag push ${{ matrix.ps-version }} --force |