name: Build docker images # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the master branch push: branches: [ master ] pull_request: branches: [ master ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # set token permissions for job so we can push to ghcr.io permissions: contents: read packages: write # build components using a job matrix, so they can run in parallel jobs: build: runs-on: ubuntu-20.04 env: TAG: ${GITHUB_SHA::8} strategy: fail-fast: true # cancel all in-progress jobs if any matrix job fails matrix: component: - downloader - restreamer - backfiller - thrimshim - cutter - sheetsync - nginx - postgres - segment_coverage - playlist_manager steps: - name: Check out repo uses: actions/checkout@v2 - name: Log into ghcr.io uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build ${{ matrix.component }} uses: docker/build-push-action@v2.7.0 with: context: ./${{ matrix.component }} file: Dockerfile tags: ghcr.io/ekimekim/wubloader-${{ matrix.component }}:${{ env.TAG }} push: true - name: Build ${{ matrix.component }} latest uses: docker/build-push-action@v2.7.0 if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' with: context: ./${{ matrix.component }} file: Dockerfile tags: ghcr.io/ekimekim/wubloader-${{ matrix.component }}:latest push: true