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

99 lines
3.0 KiB
YAML
Raw Permalink 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:
2022-05-17 12:00:24 +03:00
runs-on: ubuntu-latest
2020-06-07 01:53:23 +03:00
strategy:
fail-fast: false
2020-06-07 01:53:23 +03:00
matrix:
docker-file:
- path: 14
tags: "14 fermium"
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6
2021-08-10 13:04:14 +03:00
- path: 16
tags: "16 gallium latest"
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/arm/v7,linux/arm/v6
2021-08-10 13:04:14 +03:00
2020-06-07 01:53:23 +03:00
steps:
- name: Checkout
uses: actions/checkout@v3
2020-06-07 01:53:23 +03:00
- name: Prepare
id: prepare
run: |
2022-07-18 16:39:40 +03:00
DOCKER_IMAGE=neur0toxine/node-alpine-git-gyp
2020-06-07 01:53:23 +03:00
2020-12-14 14:30:17 +03:00
TEMP="${{ matrix.docker-file.tags }}"
TAGZ=($TEMP)
2020-06-07 01:53:23 +03:00
VERSION=${TAGZ[0]}
2020-12-14 14:30:17 +03:00
for i in "${!TAGZ[@]}"; do
if [ "$i" -eq "0" ];
then
TAGS="${DOCKER_IMAGE}:${TAGZ[$i]}"
else
TAGS="${TAGS},${DOCKER_IMAGE}:${TAGZ[$i]}"
fi
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@v2.0.0
2020-06-07 01:53:23 +03:00
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2.0.0
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@v3.0.0
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@v2.0.0
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@v3.0.0
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
2020-12-14 11:58:55 +03:00
- name: Inspect Image
if: always() && github.event_name != 'pull_request' && contains(github.ref, 'master')
2020-06-07 01:53:23 +03:00
run: |
2020-12-14 11:58:55 +03:00
docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}
2020-06-07 01:53:23 +03:00
- name: Clear
if: always() && github.event_name != 'pull_request'
run: |
rm -f ${HOME}/.docker/config.json