-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.38 KB
/
publish.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
---
name: Publish to GHCR
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
publish:
name: Publish to GHCR
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Extract Docker metadata
id: metadata
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=auto
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: spartan-ductduong
password: ${{ secrets.PAT }}
- name: Build & push
uses: docker/build-push-action@v4
with:
context: .
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
labels: ${{ steps.metadata.outputs.labels }}
tags: ${{ steps.metadata.outputs.tags }}