Skip to content

Commit

Permalink
build: push container image after successful PR merge
Browse files Browse the repository at this point in the history
  • Loading branch information
infinitewarp committed Jun 25, 2024
1 parent b0539cf commit cd1789d
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

env:
TAG_NAME: ${{ github.event_name == 'push' && github.ref_name || format('pr-{0}', github.event.pull_request.number) }}

jobs:
build-docker:
runs-on: ubuntu-latest
Expand All @@ -14,6 +17,17 @@ jobs:
- name: Buildah Action
uses: redhat-actions/buildah-build@v2
with:
image: quips
tags: ${{ github.sha }}
image: infinitewarp/quips
tags: ${{ github.sha }} ${{ TAG_NAME }}
containerfiles: ./compose/django/Dockerfile

- name: push container image
# Enable this to push *only* after the merge
# if: github.event.pull_request.merged == true
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 }}

0 comments on commit cd1789d

Please sign in to comment.