2021-01-24 14:24:37 +00:00
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Publish `main` as Docker `latest` image.
|
|
|
|
branches:
|
|
|
|
- main
|
2023-03-04 17:11:04 +00:00
|
|
|
paths-ignore:
|
|
|
|
- web/**
|
|
|
|
- doc/**
|
2021-01-24 14:24:37 +00:00
|
|
|
|
|
|
|
# Publish `v1.2.3` tags as releases.
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
|
2022-10-13 20:32:01 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-01-24 14:24:37 +00:00
|
|
|
env:
|
|
|
|
IMAGE_NAME: conky
|
|
|
|
DOCKERHUB_ACCOUNT: brndnmtthws
|
2021-03-01 00:05:44 +00:00
|
|
|
DOCKER_BUILDKIT: 1
|
2021-01-24 14:24:37 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
buildx:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-04 17:18:19 +00:00
|
|
|
uses: actions/checkout@v4
|
2021-01-24 14:24:37 +00:00
|
|
|
- name: Set up QEMU
|
2023-09-18 17:55:27 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2021-01-24 14:24:37 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2023-09-18 17:55:23 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-01-24 14:24:37 +00:00
|
|
|
- name: Log into Dockerhub registry
|
|
|
|
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u $DOCKERHUB_ACCOUNT --password-stdin
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
DOCKERHUB_IMAGE_ID=$DOCKERHUB_ACCOUNT/$IMAGE_NAME
|
|
|
|
|
|
|
|
# Change all uppercase to lowercase
|
|
|
|
DOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
|
|
|
|
|
|
# Strip git ref prefix from version
|
|
|
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
|
|
|
|
|
|
# Strip "v" prefix from tag name
|
|
|
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
|
|
|
|
|
|
# Use Docker `latest` tag convention
|
|
|
|
[ "$VERSION" == "main" ] && VERSION=latest
|
|
|
|
|
2021-03-01 00:05:44 +00:00
|
|
|
docker buildx build \
|
|
|
|
--push \
|
|
|
|
--platform linux/arm/v7,linux/arm64/v8,linux/amd64 \
|
|
|
|
--cache-from=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache \
|
2021-03-02 14:05:24 +00:00
|
|
|
--cache-to=type=registry,ref=$DOCKERHUB_ACCOUNT/$IMAGE_NAME:buildcache,mode=max \
|
2021-03-01 00:05:44 +00:00
|
|
|
--tag $DOCKERHUB_IMAGE_ID:$VERSION \
|
|
|
|
.
|