Skip to content

Commit 86e1587

Browse files
committed
Action to publish docker image to ghcr.io
1 parent baeef20 commit 86e1587

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/docker-publish.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: docker-publish
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
packages: write
10+
11+
jobs:
12+
docker-publish:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
# https://github.com/docker/setup-qemu-action
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v2
22+
23+
# https://github.com/docker/setup-buildx-action
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Login to GHCR
28+
uses: docker/login-action@v2
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
# https://github.com/docker/metadata-action
35+
- name: Docker meta
36+
id: meta
37+
uses: docker/metadata-action@v4
38+
with:
39+
# List of Docker images to use as base name for tags
40+
images: |
41+
ghcr.io/mafrosis/tinytuya2mqtt
42+
# Docker tags based on the following events/attributes
43+
tags: |
44+
type=schedule
45+
type=ref,event=branch
46+
type=ref,event=pr
47+
type=pep440,pattern={{version}},value=${{ steps.version.outputs.version }}
48+
type=sha
49+
50+
# https://github.com/docker/build-push-action
51+
- name: Build and push
52+
uses: docker/build-push-action@v3
53+
with:
54+
context: .
55+
push: true
56+
platforms: linux/arm64,linux/amd64,linux/arm/v7
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)