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 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 }} # always push # if not a pull request and a push to master, also push "latest" tag # try to cache from previous build and then build component using build script run: | export PUSH=true if [ "$GITHUB_EVENT_NAME" != "pull_request" ] && [ "$GITHUB_REF" == "refs/heads/master" ]; then export PUSH=latest; fi CACHE_FROM=$(git rev-list HEAD -n1 --parents | cut -d" " -f 2-) ./build ${{ matrix.component }}