Move containers build to CI #5
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: Login to DockerHub | ||
if: ${{ secrets.DOCKER_USERNAME != '' }} | ||
Check failure on line 40 in .github/workflows/containers.yaml GitHub Actions / Docker ContainersInvalid workflow file
|
||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
- name: Build Docker image | ||
run: build/containers/build.sh --containers ${{ matrix.container }} | ||
push-containers: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- changed-containers | ||
- build-containers | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Login to DockerHub | ||
if: ${{ secrets.DOCKER_USERNAME != '' }} | ||
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
- name: Push Docker images | ||
if: ${{ secrets.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}" |