From ca1bf564761ffa002919ec4bb2d0cc693aef9821 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20C=C3=A1rcamo?= Date: Wed, 8 May 2024 16:21:10 -0400 Subject: [PATCH] ADD: adding workflow to create container image when tagging --- .github/workflows/build_tagged_container.yml | 35 ++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build_tagged_container.yml diff --git a/.github/workflows/build_tagged_container.yml b/.github/workflows/build_tagged_container.yml new file mode 100644 index 0000000..01e6c3a --- /dev/null +++ b/.github/workflows/build_tagged_container.yml @@ -0,0 +1,35 @@ +name: build-tagged-container + +on: + push: + tags: + - '*' +env: + REGISTRY: ghcr.io + +jobs: + build-tagged-container: + runs-on: ubuntu-latest + steps: + - name: Get tag + id: tag + uses: dawidd6/action-get-tag@v1 + with: + # Optionally strip `v` prefix + strip_v: true + - name: Checkout Code + uses: actions/checkout@v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + file: ./Dockerfile.prod + push: true # Will only build if this is not here + tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{steps.tag.outputs.tag}} + secrets: | + "BRANCH_NAME=${{ github.head_ref || github.ref_name }}"