1+ name : Publish to GHCR.io
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ workflow_dispatch :
8+
9+ env :
10+ REGISTRY : ghcr.io
11+ IMAGE_NAME : ${{ github.repository }}
12+
13+ jobs :
14+ build_tag_push_to_ghcr :
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
23+
24+
25+ - name : Set up QEMU
26+ uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
27+
28+ - name : Setup Docker buildx
29+ uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
30+
31+ - name : Log into registry ${{ env.REGISTRY }}
32+ uses : docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
33+ with :
34+ registry : ${{ env.REGISTRY }}
35+ username : ${{ github.actor }}
36+ password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Extract Docker metadata
39+ id : meta
40+ uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
41+ with :
42+ github-token : ${{ secrets.GITHUB_TOKEN }}
43+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+ tags : |
45+ type=ref,event=branch,prefix=
46+ type=ref,event=tag,prefix=
47+ type=sha,format=short,prefix=
48+ type=sha,format=long,prefix=
49+ - name : Build and push Docker image
50+ id : build-and-push
51+ uses : docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
52+ with :
53+ context : .
54+ push : ${{ github.event_name != 'pull_request' }}
55+ tags : ${{ steps.meta.outputs.tags }}
56+ labels : ${{ steps.meta.outputs.labels }}
57+ provenance : false
58+ cache-from : type=gha
59+ cache-to : type=gha,mode=max
0 commit comments