Skip to content

chore(main): release 0.1.3 (#105) #291

chore(main): release 0.1.3 (#105)

chore(main): release 0.1.3 (#105) #291

Workflow file for this run

name: Docker Build
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
permissions:
contents: read
jobs:
docker-build:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- '5000:5000'
env:
DOCKER_BUILDKIT: 1
DOCKER_CLI_EXPERIMENTAL: enabled
IMG_NAME: sagemcom_fast_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/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: |
image=moby/buildkit:buildx-stable-1
network=host
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
if: github.repository == 'hairyhenderson/sagemcom_fast_exporter' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: hairyhenderson
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.repository == 'hairyhenderson/sagemcom_fast_exporter' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
- name: Build & Push (non-main branch)
run: |
set -ex
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=localhost:5000/${{ github.repository }} BUILDX_ACTION=--push
docker buildx imagetools create --dry-run -t localhost:5000/${{ github.repository }}:dev localhost:5000/${{ github.repository }}:latest
docker buildx imagetools create --dry-run -t localhost:5000/${{ github.repository }}:dev-alpine localhost:5000/${{ github.repository }}:alpine
if: github.repository != 'hairyhenderson/sagemcom_fast_exporter' || github.ref != 'refs/heads/main'
- name: Build & Push (main/tags)
run: |
src_repo=${{ github.repository}}
set -x
make docker-multi COMMIT=${{ github.sha }} DOCKER_REPO=${src_repo} BUILDX_ACTION=--push
set -x
docker buildx imagetools create -t ghcr.io/${src_repo}:latest ${src_repo}:latest
docker buildx imagetools create -t ghcr.io/${src_repo}:alpine ${src_repo}:alpine
if: github.repository == 'hairyhenderson/sagemcom_fast_exporter' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
- name: Push (tagged release)
run: |
src_repo=${{ github.repository }}
git_tag=${{ github.ref_name }}
major_version=${git_tag%%\.*}
set -x
repo=$src_repo
docker buildx imagetools create -t ${repo}:${git_tag} ${src_repo}:latest
docker buildx imagetools create -t ${repo}:${major_version} ${src_repo}:latest
docker buildx imagetools create -t ${repo}:${git_tag}-alpine ${src_repo}:alpine
docker buildx imagetools create -t ${repo}:${major_version}-alpine ${src_repo}:alpine
repo=ghcr.io/${{ github.repository }}
docker buildx imagetools create -t ${repo}:${git_tag} ${src_repo}:latest
docker buildx imagetools create -t ${repo}:${major_version} ${src_repo}:latest
docker buildx imagetools create -t ${repo}:${git_tag}-alpine ${src_repo}:alpine
docker buildx imagetools create -t ${repo}:${major_version}-alpine ${src_repo}:alpine
if: github.repository == 'hairyhenderson/sagemcom_fast_exporter' && startsWith(github.ref, 'refs/tags/')