-
Notifications
You must be signed in to change notification settings - Fork 9
69 lines (68 loc) · 2.15 KB
/
build-and-push-dockerhub.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Build and push docker image
on:
schedule:
- cron: "0 3 * * *"
push:
branches:
- main
env:
IMAGE_NAME: snapcast
NAMESPACE: sweisgerber
SNAPCAST_VERSION: 0.31.0-r0
LIBRESPOT_VERSION: 0.6.0-r0
jobs:
docker:
runs-on: ubuntu-latest
environment: main
steps:
# CHECKOUT
- name: Checkout
uses: actions/checkout@v3
# QEMU Setup
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# BUILDX Setup
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# DockerHub Login
- name: Login to the Docker Hub registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# GHCR Docker Login
- name: Log in to the ghcr Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Metadata
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.4.0
with:
images: |
${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
ghcr.io/${{ env.NAMESPACE }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=v${{ env.SNAPCAST_VERSION }},enable={{is_default_branch}}
type=schedule
# type=ref,event=branch
type=ref,event=tag
# type=ref,event=pr
# Build & Push
- name: Build and push Docker images
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
SNAPCAST_RELEASE=${{ env.SNAPCAST_VERSION }}
LIBRESPOT_RELEASE=${{ env.LIBRESPOT_VERSION }}
VERSION=snapcast-${{ env.SNAPCAST_VERSION }}-librespot-${{ env.LIBRESPOT_VERSION }}