Skip to content

Commit 8acdbf6

Browse files
authored
Merge pull request #10 from notesofcliff/codex/update-ci/cd-pipeline-for-container-image-builds
ci: build and publish docker image
2 parents 2783cc2 + a3ec9e8 commit 8acdbf6

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and Publish Container Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Set up QEMU
20+
uses: docker/setup-qemu-action@v3
21+
22+
- name: Set up Docker Buildx
23+
uses: docker/setup-buildx-action@v3
24+
25+
- name: Extract version
26+
id: vars
27+
run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
28+
29+
- name: Log in to ghcr
30+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build and push Docker image
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: .
41+
file: Dockerfile
42+
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
43+
tags: |
44+
ghcr.io/${{ github.repository_owner }}/delve:${{ env.VERSION }}
45+
ghcr.io/${{ github.repository_owner }}/delve:latest
46+
cache-from: type=gha
47+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)