docker-node-alpine-git-gyp/.github/workflows/buildx.yml
2020-06-07 00:53:23 +02:00

77 lines
2.5 KiB
YAML

name: buildx
on:
schedule:
- cron: '37 06 * * *'
pull_request:
push:
jobs:
buildx:
runs-on: ubuntu-latest
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
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=timbru31/node-alpine-git
TAGZ=$(echo ${{ matrix.docker-file.tags }} | tr "," "\n")
VERSION=${TAGZ[0]}
for tag in $TAGZ
do
TAGS="${TAGS} --tag ${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 }}
- name: Set up Docker Buildx
id: buildx
uses: crazy-max/ghaction-docker-buildx@v2
- 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 }}
- 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
- 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 }}
- name: Docker Check Manifest
if: always() && github.event_name != 'pull_request'
run: |
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
- name: Clear
if: always() && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json