docker-node-alpine-git-gyp/.github/workflows/buildx.yml

92 lines
2.8 KiB
YAML
Raw Normal View History

2020-06-07 01:53:23 +03:00
name: buildx
on:
schedule:
- cron: "37 06 * * *"
2020-06-07 01:53:23 +03:00
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
2020-06-07 01:53:23 +03:00
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},${DOCKER_IMAGE}:${tag}"
2020-06-07 01:53:23 +03:00
done
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=tags::${TAGS}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
2020-06-07 01:53:23 +03:00
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
2020-06-07 01:53:23 +03:00
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Docker Buildx (build)
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 }}
2020-06-07 01:53:23 +03:00
- name: Docker Login
if: success() && contains(github.ref, 'master')
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
2020-06-07 01:53:23 +03:00
- name: Docker Buildx (push)
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 }}
2020-06-07 01:53:23 +03:00
- 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