2021-05-01 19:53:15 +02:00
|
|
|
name: deploy multi-architecture Docker images for transfer.sh with buildx
|
2020-06-14 21:42:00 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *' # everyday at midnight UTC
|
|
|
|
pull_request:
|
2021-12-07 20:24:58 +01:00
|
|
|
branches: main
|
2020-06-14 21:42:00 +02:00
|
|
|
push:
|
2021-12-07 20:24:58 +01:00
|
|
|
branches: main
|
2020-06-14 21:42:00 +02:00
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
buildx:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
-
|
|
|
|
name: Prepare
|
|
|
|
id: prepare
|
|
|
|
run: |
|
|
|
|
DOCKER_IMAGE=dutchcoders/transfer.sh
|
|
|
|
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64,linux/386
|
|
|
|
VERSION=edge
|
|
|
|
|
|
|
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
2021-02-19 14:50:40 +01:00
|
|
|
VERSION=v${GITHUB_REF#refs/tags/v}
|
2020-06-14 21:42:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
|
|
|
VERSION=nightly
|
|
|
|
fi
|
|
|
|
|
|
|
|
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
2022-04-03 14:55:15 +02:00
|
|
|
TAGS_NOROOT="--tag ${DOCKER_IMAGE}:${VERSION}-noroot"
|
2020-06-14 21:42:00 +02:00
|
|
|
|
|
|
|
if [ $VERSION = edge -o $VERSION = nightly ]; then
|
|
|
|
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
|
2022-04-03 14:55:15 +02:00
|
|
|
TAGS_NOROOT="$TAGS_NOROOT --tag ${DOCKER_IMAGE}:latest-noroot"
|
2020-06-14 21:42:00 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo ::set-output name=docker_image::${DOCKER_IMAGE}
|
|
|
|
echo ::set-output name=version::${VERSION}
|
|
|
|
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
|
|
|
|
--build-arg VERSION=${VERSION} \
|
|
|
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
|
|
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
|
|
|
${TAGS} .
|
2022-04-03 14:55:15 +02:00
|
|
|
echo ::set-output name=buildx_args_noroot::--platform ${DOCKER_PLATFORMS} \
|
|
|
|
--build-arg VERSION=${VERSION} \
|
|
|
|
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
|
|
|
|
--build-arg VCS_REF=${GITHUB_SHA::8} \
|
|
|
|
--build-arg RUNAS=noroot \
|
|
|
|
${TAGS_NOROOT} .
|
2020-10-21 00:30:52 +02:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
with:
|
|
|
|
platforms: all
|
2020-06-14 21:42:00 +02:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2020-10-21 00:30:52 +02:00
|
|
|
id: buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
-
|
|
|
|
name: Available platforms
|
|
|
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
2020-06-14 21:42:00 +02:00
|
|
|
-
|
|
|
|
name: Docker Buildx (build)
|
|
|
|
run: |
|
|
|
|
docker buildx build --no-cache --pull --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }}
|
2022-04-03 14:55:15 +02:00
|
|
|
docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args_noroot }}
|
2020-06-14 21:42:00 +02:00
|
|
|
-
|
|
|
|
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 }}
|
2022-04-03 14:55:15 +02:00
|
|
|
docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args_noroot }}
|
2020-06-14 21:42:00 +02: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 }}
|
2022-04-03 14:55:15 +02:00
|
|
|
docker run --rm mplatform/mquery ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}-noroot
|
2020-06-14 21:42:00 +02:00
|
|
|
-
|
|
|
|
name: Clear
|
|
|
|
if: always() && github.event_name != 'pull_request'
|
|
|
|
run: |
|
|
|
|
rm -f ${HOME}/.docker/config.json
|