Bump docker/setup-buildx-action from 3.7.1 to 3.8.0 #261
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build | |
on: | |
push: | |
jobs: | |
docker-build: | |
runs-on: ubuntu-20.04 | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- '5000:5000' | |
env: | |
DOCKER_BUILDKIT: 1 | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
IMG_NAME: jarvis_exporter | |
steps: | |
- name: enable experimental mode | |
run: | | |
mkdir -p ~/.docker | |
echo '{"experimental": "enabled"}' > ~/.docker/config.json | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
with: | |
version: v0.5.1 | |
driver-opts: | | |
image=moby/buildkit:buildx-stable-1 | |
network=host | |
- name: Available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: determine if this is a tag | |
run: | | |
if (git describe --abbrev=0 --exact-match &>/dev/null); then | |
tag=$(git describe --abbrev=0 --exact-match) | |
echo "is_tag=true" >> $GITHUB_ENV | |
echo "git_tag=$tag" >> $GITHUB_ENV | |
# splits the major version from $tag - assumes it's a 3-part semver | |
echo "major_version=${tag%%\.*}" >> $GITHUB_ENV | |
fi | |
if: github.repository == 'hairyhenderson/jarvis_exporter' | |
- name: Login to DockerHub | |
uses: docker/[email protected] | |
with: | |
username: hairyhenderson | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
if: github.repository == 'hairyhenderson/jarvis_exporter' && (github.ref == 'refs/heads/main' || env.is_tag == 'true') | |
- name: Build & Push (non-main branch) | |
run: | | |
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=localhost:5000/${IMG_NAME} BUILDX_ACTION=--push | |
docker buildx imagetools create --dry-run -t localhost:5000/${IMG_NAME}:dev localhost:5000/${IMG_NAME}:latest | |
if: github.repository != 'hairyhenderson/jarvis_exporter' || github.ref != 'refs/heads/main' | |
- name: Build & Push (main branch) | |
run: | | |
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=hairyhenderson/${IMG_NAME} BUILDX_ACTION=--push | |
if: github.repository == 'hairyhenderson/jarvis_exporter' && github.ref == 'refs/heads/main' | |
- name: Build & Push (tagged release) | |
run: | | |
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=hairyhenderson/${IMG_NAME} BUILDX_ACTION=--push | |
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${git_tag} hairyhenderson/${IMG_NAME}:latest | |
docker buildx imagetools create -t hairyhenderson/${IMG_NAME}:${major_version} hairyhenderson/${IMG_NAME}:latest | |
if: github.repository == 'hairyhenderson/jarvis_exporter' && env.is_tag == 'true' |