-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (34 loc) · 1.19 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Build container image
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
TAG_NAME: ${{ github.event_name == 'push' && github.ref_name || format('pr-{0}', github.event.pull_request.number) }}
jobs:
build-container-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: infinitewarp/quips
tags: ${{ github.sha }} ${{ env.TAG_NAME }}
containerfiles: ./compose/django/Dockerfile
- name: push image
id: push-to-registry
# Push *only* after the merge. Until I actually need to push PR images, why waste storage?
if: github.event_name == 'push'
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ secrets.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Show image url
if: github.event_name == 'push'
run: echo "Image pushed to ${{ steps.push-to-registry.outputs.registry-paths }}"