You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/.github/workflows/release_docker.yml

108 lines
2.9 KiB
YAML

name: release_docker
on:
push:
tags:
- "v*"
jobs:
build:
name: Release Docker
runs-on: ubuntu-latest
strategy:
matrix:
platforms:
- linux/amd64
- linux/arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: synctvorg/synctv
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare
id: prepare
run: |
echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT
echo "TARFILE=${platforms//\//-}.tar" >> $GITHUB_OUTPUT
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
build-args:
VERSION=v${{ steps.prepare.outputs.VERSION }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}
outputs: type=docker,dest=/tmp/images/${{ steps.prepare.outputs.TARFILE }}
- name: Upload image
uses: actions/upload-artifact@v4
with:
name: images
path: /tmp/images/${{ steps.prepare.outputs.TARFILE }}
if-no-files-found: error
retention-days: 1
push:
runs-on: ubuntu-latest
needs:
- build
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
-
name: Download images
uses: actions/download-artifact@v3
with:
name: images
path: /tmp/images
-
name: Load images
run: |
for image in /tmp/images/*.tar; do
docker load -i $image
done
-
name: Push images to local registry
run: |
docker push -a ${{ env.TMP_LOCAL_IMAGE }}
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create manifest list and push
run: |
docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:${{ env.REGISTRY_TAG }} \
$(docker image ls --format '{{.Repository}}:{{.Tag}}' '${{ env.TMP_LOCAL_IMAGE }}' | tr '\n' ' ')
-
name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ env.REGISTRY_TAG }}