Move containers build to CI #9
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: Docker Containers | |
on: | |
push: | |
paths: | |
- build/containers/** | |
jobs: | |
changed-containers: | |
runs-on: ubuntu-latest | |
outputs: | |
containers: ${{ steps.determine-containers.outputs.containers }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- id: determine-containers | |
name: Determine changed containers | |
run: | | |
containers=$( build/containers/build.sh --changed-containers-as-json) | |
echo "containers=${containers}" >> "$GITHUB_OUTPUT" | |
build-containers: | |
runs-on: ubuntu-latest | |
needs: changed-containers | |
strategy: | |
max-parallel: 4 | |
fail-fast: true | |
matrix: | |
container: ${{ fromJSON(needs.changed-containers.outputs.containers) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Build Docker image | |
run: build/containers/build.sh --containers ${{ matrix.container }} | |
push-containers: | |
runs-on: ubuntu-latest | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
needs: | |
- changed-containers | |
- build-containers | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
if: ${{ env.DOCKER_USERNAME != '' }} | |
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: Push Docker images | |
if: ${{ env.DOCKER_USERNAME != '' }} | |
run: | | |
containers=${{ needs.changed-containers.outputs.containers }} | |
containers=$( echo "${containers}" | sed 's/[][]//g' ) | |
build/containers/build.sh --dry-run --skip-build --push --containers "${containers}" |