Skip to content

Commit 8813a93

Browse files
committed
add publish devcontainer workflow
1 parent 2ca1ef2 commit 8813a93

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
- name: Log in to Container Registry
30+
uses: docker/login-action@v3
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Extract metadata
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
type=ref,event=branch
43+
type=sha,prefix={{branch}}-
44+
type=raw,value=latest,enable={{is_default_branch}}
45+
46+
- name: Build and push devcontainer image
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
file: .devcontainer/Dockerfile
51+
push: true
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}
54+
cache-from: type=gha
55+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)