build: corrects migration to Docker's GH actions (#122)

This commit is contained in:
Tim Brust 2020-10-08 09:59:45 +00:00 committed by GitHub
parent 9a2e2659cd
commit 2c7c16d29c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ name: buildx
on: on:
schedule: schedule:
- cron: '37 06 * * *' - cron: "37 06 * * *"
pull_request: pull_request:
push: push:
@ -32,40 +32,53 @@ jobs:
for tag in $TAGZ for tag in $TAGZ
do do
TAGS="${TAGS} --tag ${DOCKER_IMAGE}:${tag}" TAGS="${TAGS},${DOCKER_IMAGE}:${tag}"
done done
echo ::set-output name=docker_image::${DOCKER_IMAGE} echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION} echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${{ matrix.docker-file.platforms }} \ echo ::set-output name=tags::${TAGS}
--build-arg REFRESHED_AT=$(date +%Y-%m-%d) \
${TAGS} --file ./${{ matrix.docker-file.path }}/Dockerfile ./${{ matrix.docker-file.path }} - name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
id: buildx id: buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
with: with:
version: latest install: true
- name: Available platforms - name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }} run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker Buildx (build) - name: Docker Buildx (build)
run: | uses: docker/build-push-action@v2
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} 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 - name: Docker Login
if: success() && github.event_name != 'pull_request' if: success() && contains(github.ref, 'master')
env: uses: docker/login-action@v1
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} with:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} username: ${{ secrets.DOCKER_USERNAME }}
run: | password: ${{ secrets.DOCKER_PASSWORD }}
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Docker Buildx (push) - name: Docker Buildx (push)
if: success() && github.event_name != 'pull_request' uses: docker/build-push-action@v2
run: | if: success() && contains(github.ref, 'master')
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} 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 - name: Docker Check Manifest
if: always() && github.event_name != 'pull_request' if: always() && github.event_name != 'pull_request'