File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed
Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ name : publish-image
2+
3+ on :
4+ workflow_dispatch :
5+ workflow_run :
6+ branches : ['main']
7+
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : ${{ github.repository }}
11+
12+ jobs :
13+ build-and-push-image :
14+ if : ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
15+ runs-on : ubuntu-latest
16+ permissions :
17+ contents : read
18+ packages : write
19+
20+ steps :
21+ - name : Checkout repository
22+ uses : actions/checkout@v4
23+
24+ - name : Log in to the Container registry
25+ uses : docker/login-action@v3
26+ with :
27+ registry : ${{ env.REGISTRY }}
28+ username : ${{ github.actor }}
29+ password : ${{ secrets.GITHUB_TOKEN }}
30+
31+ - name : Extract metadata (tags, labels) for Docker
32+ id : meta
33+ uses : docker/metadata-action@v5
34+ with :
35+ images : ghcr.io/${{ github.repository }}
36+
37+ - name : Cache Docker layers
38+ uses : actions/cache@v3
39+ with :
40+ path : /tmp/.buildx-cache
41+ key : ${{ runner.os }}-buildx-Dockerfile }}
42+ restore-keys : |
43+ ${{ runner.os }}-buildx-
44+
45+ - name : Set up Docker Buildx
46+ uses : docker/setup-buildx-action@v3
47+
48+ - name : Build and push Docker image
49+ uses : docker/build-push-action@v6
50+ with :
51+ context : .
52+ file : Dockerfile
53+ push : true
54+ tags : ${{ steps.meta.outputs.tags }}
55+ labels : ${{ steps.meta.outputs.labels }}
56+ cache-from : type=local,src=/tmp/.buildx-cache
57+ cache-to : type=local,dest=/tmp/.buildx-cache,mode=max
You can’t perform that action at this time.
0 commit comments