From 2c7c16d29c4fe5fda31530f5194ea34bf8051379 Mon Sep 17 00:00:00 2001 From: Tim Brust Date: Thu, 8 Oct 2020 09:59:45 +0000 Subject: [PATCH] build: corrects migration to Docker's GH actions (#122) --- .github/workflows/buildx.yml | 59 ++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/.github/workflows/buildx.yml b/.github/workflows/buildx.yml index a084311..90734fd 100644 --- a/.github/workflows/buildx.yml +++ b/.github/workflows/buildx.yml @@ -2,7 +2,7 @@ name: buildx on: schedule: - - cron: '37 06 * * *' + - cron: "37 06 * * *" pull_request: push: @@ -12,12 +12,12 @@ jobs: strategy: matrix: docker-file: - - path: 10 - tags: 10,dubnium - platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 - - path: 12 - tags: 12,erbium,latest - platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 + - path: 10 + tags: 10,dubnium + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 + - path: 12 + tags: 12,erbium,latest + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 steps: - name: Checkout uses: actions/checkout@v2 @@ -32,40 +32,53 @@ jobs: for tag in $TAGZ do - TAGS="${TAGS} --tag ${DOCKER_IMAGE}:${tag}" + TAGS="${TAGS},${DOCKER_IMAGE}:${tag}" done echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=version::${VERSION} - echo ::set-output name=buildx_args::--platform ${{ matrix.docker-file.platforms }} \ - --build-arg REFRESHED_AT=$(date +%Y-%m-%d) \ - ${TAGS} --file ./${{ matrix.docker-file.path }}/Dockerfile ./${{ matrix.docker-file.path }} + echo ::set-output name=tags::${TAGS} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 with: - version: latest + install: true - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} - name: Docker Buildx (build) - run: | - docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} + uses: docker/build-push-action@v2 + if: success() && !contains(github.ref, 'master') + with: + push: false + context: ./${{ matrix.docker-file.path }} + file: ./${{ matrix.docker-file.path }}/Dockerfile + build-args: REFRESHED_AT=$(date +%Y-%m-%d) + platforms: ${{ matrix.docker-file.platforms }} + tags: ${{ steps.prepare.outputs.tags }} - name: Docker Login - if: success() && github.event_name != 'pull_request' - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: | - echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin + if: success() && contains(github.ref, 'master') + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} - name: Docker Buildx (push) - if: success() && github.event_name != 'pull_request' - run: | - docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} + uses: docker/build-push-action@v2 + if: success() && contains(github.ref, 'master') + with: + push: true + context: ./${{ matrix.docker-file.path }} + file: ./${{ matrix.docker-file.path }}/Dockerfile + build-args: REFRESHED_AT=$(date +%Y-%m-%d) + platforms: ${{ matrix.docker-file.platforms }} + tags: ${{ steps.prepare.outputs.tags }} - name: Docker Check Manifest if: always() && github.event_name != 'pull_request'