Skip to content

ci: bump docker/setup-qemu-action to v3 #27

ci: bump docker/setup-qemu-action to v3

ci: bump docker/setup-qemu-action to v3 #27

Workflow file for this run

name: buildx
on:
push:
branches:
- "master"
tags:
- "v*"
paths:
- ".github/workflows/buildx.yml"
- "Dockerfile"
jobs:
teslamatetelegrambot:
runs-on: ubuntu-latest
steps:
- name: Prepare
id: prepare
run: |
DOCKER_USERNAME=teslamatetelegrambot
DOCKER_IMAGE=teslamatetelegrambot/teslamatetelegrambot
DOCKER_PLATFORMS=linux/amd64,linux/arm/v7,linux/arm64
VERSION=edge
if [[ $GITHUB_REF == refs/tags/v* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
MINOR_VERSION=${VERSION%.*}
fi
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
if [ "$VERSION" != "edge" ]; then
TAGS="$TAGS --tag ${DOCKER_IMAGE}:${MINOR_VERSION} --tag ${DOCKER_IMAGE}:latest"
fi
echo ::set-output name=docker_username::${DOCKER_USERNAME}
echo ::set-output name=docker_image::${DOCKER_IMAGE}
echo ::set-output name=version::${VERSION}
echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \
${TAGS} --file Dockerfile .
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Cache Docker layers
uses: actions/cache@v2
id: cache
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-teslamatetelegrambot-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-teslamatetelegrambot-
- name: Docker Buildx (build)
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache,mode=max" \
--output "type=image,push=false" \
${{ steps.prepare.outputs.buildx_args }}
- name: Docker Login
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
uses: docker/login-action@v1
with:
username: ${{ steps.prepare.outputs.docker_username }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Buildx (push)
if: success() && github.event_name != 'pull_request' && (endsWith(github.ref, github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/'))
run: |
docker buildx build \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--output "type=image,push=true" \
${{ steps.prepare.outputs.buildx_args }}
- name: Clear
if: always()
run: |
rm -f ${HOME}/.docker/config.json