Skip to content

Commit 3515cd8

Browse files
committed
add gh action to push to docker hub
1 parent 7e489d4 commit 3515cd8

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: Publish Docker image
11+
12+
on:
13+
release:
14+
types: [published]
15+
workflow_dispatch:
16+
inputs:
17+
tags:
18+
description: "Tags to deploy"
19+
required: true
20+
type: string
21+
22+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
23+
env:
24+
REGISTRY: docker.io
25+
IMAGE_NAME: docbobo/roon-extension-denon
26+
27+
jobs:
28+
push_to_registry:
29+
name: Push Docker image to Docker Hub
30+
runs-on: ubuntu-latest
31+
32+
environment: production
33+
permissions:
34+
packages: write
35+
contents: read
36+
attestations: write
37+
id-token: write
38+
steps:
39+
- name: Check out the repo
40+
uses: actions/checkout@v4
41+
42+
- name: Log in to Docker Hub
43+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
44+
with:
45+
username: ${{ secrets.DOCKER_USERNAME }}
46+
password: ${{ secrets.DOCKER_PASSWORD }}
47+
48+
- name: Set up QEMU
49+
uses: docker/setup-qemu-action@v3
50+
51+
- name: Set up Docker Buildx
52+
uses: docker/setup-buildx-action@v3
53+
54+
- name: Extract metadata (tags, labels) for Docker
55+
id: meta
56+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
57+
with:
58+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
59+
60+
- name: Build and push Docker image
61+
id: push
62+
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
63+
uses: docker/build-push-action@v6
64+
with:
65+
platforms: linux/amd64,linux/arm64
66+
context: .
67+
file: ./Dockerfile
68+
push: true
69+
tags: ${{ steps.meta.outputs.tags }}
70+
labels: ${{ steps.meta.outputs.labels }}
71+
72+
# - name: Generate artifact attestation
73+
# uses: actions/attest-build-provenance@v2
74+
# with:
75+
# subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
76+
# subject-digest: ${{ steps.push.outputs.digest }}
77+
# push-to-registry: true

0 commit comments

Comments
 (0)