2021-01-24 14:24:37 +00:00
|
|
|
name: Docker
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Publish `main` as Docker `latest` image.
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
|
|
|
|
# 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
|
2022-10-13 20:47:26 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-01-24 14:24:37 +00:00
|
|
|
- name: Set up QEMU
|
2022-09-10 17:29:21 +00:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-01-24 14:24:37 +00:00
|
|
|
- name: Set up Docker Buildx
|
|
|
|
id: buildx
|
2022-09-10 17:29:21 +00:00
|
|
|
uses: docker/setup-buildx-action@v2
|
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 \
|
|
|
|
.
|