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:
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'