Skip to content

Commit 9950429

Browse files
Add github CI for image building (beyond-all-reason#1344)
* added image build CI file (#2) * updated to create tagged image on release * added sha tagged image, and deduplicated builds * specified step name
1 parent 5b77c68 commit 9950429

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: build prod container image and push to registry
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
name: Build prod container
15+
permissions:
16+
packages: write
17+
contents: read
18+
env:
19+
REGISTRY: ghcr.io
20+
IMAGE: ghcr.io/${{ github.repository }}
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Login to registry
26+
run: buildah login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} $REGISTRY
27+
28+
- name: Build image
29+
run: buildah bud -t $IMAGE:latest .
30+
31+
- name: Push latest image
32+
run: buildah push $IMAGE:latest
33+
34+
- name: Push sha tagged image
35+
run: buildah push $IMAGE:latest $IMAGE:${{ github.sha }}
36+
37+
- name: Push release tagged image
38+
if: github.event_name == 'release'
39+
run: buildah push $IMAGE:latest $IMAGE:${{ github.event.release.tag_name }}

0 commit comments

Comments
 (0)