diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0eba3ad..3dfd4e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 }}