Skip to content

Commit 407cab6

Browse files
authored
Create publish-dockerhub.yml
1 parent 5b259f7 commit 407cab6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: publish
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags: [ "v*" ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
dockerhub:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: docker/setup-buildx-action@v3
20+
21+
- uses: docker/login-action@v3
22+
with:
23+
username: ${{ secrets.DOCKERHUB_USERNAME }}
24+
password: ${{ secrets.DOCKERHUB_TOKEN }}
25+
26+
- id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: ${{ secrets.DOCKERHUB_USERNAME }}/downpatch-web
30+
tags: |
31+
type=raw,value=latest,enable={{is_default_branch}}
32+
type=ref,event=tag
33+
type=sha,format=short
34+
35+
- uses: docker/build-push-action@v6
36+
with:
37+
context: .
38+
file: ./Dockerfile
39+
push: true
40+
tags: ${{ steps.meta.outputs.tags }}
41+
labels: ${{ steps.meta.outputs.labels }}
42+
cache-from: type=gha
43+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)