name: build on: workflow_dispatch: push: branches: - 'master' - 'test/github-actions' jobs: matrix: runs-on: ubuntu-latest outputs: core: ${{ steps.step1.outputs.core }} rest: ${{ steps.step1.outputs.rest }} all: ${{ steps.step1.outputs.all }} steps: - name: Checkout uses: actions/checkout@v3 - name: Generate outputs id: step1 run: | echo "core=$(./.github/list-subimages --core --json)" >>$GITHUB_OUTPUT echo "rest=$(./.github/list-subimages --rest --json)" >>$GITHUB_OUTPUT echo "all=$(./.github/list-subimages --json)" >>$GITHUB_OUTPUT echo "GITHUB_OUTPUT:" cat $GITHUB_OUTPUT build-core: needs: matrix strategy: matrix: subimage: ${{ fromJson(needs.matrix.outputs.core) }} uses: ./.github/workflows/build-subimage.yml with: subimage: ${{ matrix.subimage }} tags: | type=sha,format=long secrets: inherit build-rest: needs: [matrix, build-core] strategy: matrix: subimage: ${{ fromJson(needs.matrix.outputs.rest) }} uses: ./.github/workflows/build-subimage.yml with: subimage: ${{ matrix.subimage }} tags: | type=sha,format=long secrets: inherit test: needs: build-rest runs-on: ubuntu-latest env: DOCKER_IMAGE_TAG: sha-${{ github.sha }} # needed to run the correct version through the wrapper steps: - name: Checkout uses: actions/checkout@v3 - name: Install wrapper run: | sudo apt-get install -y python3-pip cd wrapper && pip install . - name: Test run: | ocrd --version ocrd-dinglehopper --version # At this point, we have successfully built, uploaded and tested the images. We now just need to add # tags. We do this by building again, but using the formerly built images to # cache from. push-with-tags: needs: [matrix, test] strategy: matrix: subimage: ${{ fromJson(needs.matrix.outputs.all) }} uses: ./.github/workflows/build-subimage.yml with: subimage: ${{ matrix.subimage }} tags: | type=sha,format=long type=ref,event=tag secrets: inherit