File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish Devcontainer to GHCR
2
+
3
+ on :
4
+ push :
5
+ branches : [main]
6
+ paths :
7
+ - ' .devcontainer/Dockerfile'
8
+ - ' .github/workflows/publish-devcontainer.yml'
9
+ workflow_dispatch :
10
+
11
+ env :
12
+ REGISTRY : ghcr.io
13
+ IMAGE_NAME : ${{ github.repository }}/devcontainer
14
+
15
+ jobs :
16
+ publish-devcontainer :
17
+ runs-on : ubuntu-latest
18
+ permissions :
19
+ contents : read
20
+ packages : write
21
+
22
+ steps :
23
+ - name : Checkout repository
24
+ uses : actions/checkout@v4
25
+ - name : Set up Docker Buildx
26
+ uses : docker/setup-buildx-action@v3
27
+ - name : Log in to Container Registry
28
+ uses : docker/login-action@v3
29
+ with :
30
+ registry : ${{ env.REGISTRY }}
31
+ username : ${{ github.actor }}
32
+ password : ${{ secrets.GITHUB_TOKEN }}
33
+ - name : Extract metadata
34
+ id : meta
35
+ uses : docker/metadata-action@v5
36
+ with :
37
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38
+ tags : |
39
+ type=ref,event=branch
40
+ type=sha,prefix={{branch}}-
41
+ type=raw,value=latest,enable={{is_default_branch}}
42
+ - name : Build and push devcontainer image
43
+ uses : docker/build-push-action@v6
44
+ with :
45
+ context : .
46
+ file : .devcontainer/Dockerfile
47
+ push : true
48
+ tags : ${{ steps.meta.outputs.tags }}
49
+ labels : ${{ steps.meta.outputs.labels }}
50
+ cache-from : type=gha
51
+ cache-to : type=gha,mode=max
You can’t perform that action at this time.
0 commit comments