Skip to content

Commit

Permalink
put docker image name into an env var
Browse files Browse the repository at this point in the history
  • Loading branch information
TimHess committed Feb 9, 2024
1 parent 1820a5b commit 09c3a70
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-and-stage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and deploy
name: Build and stage

on:
pull_request:
Expand All @@ -17,6 +17,7 @@ permissions:
pull-requests: 'write'

env:
IMAGE_NAME: initializr-web
IMAGE_TAG: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || github.run_id }}

jobs:
Expand Down Expand Up @@ -44,10 +45,10 @@ jobs:
password: "${{ secrets.DOCKER_PASSWORD }}"

- name: Build image
run: docker build . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
run: docker build . --file "Dockerfile" -t ${{ vars.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

- name: Push image
run: docker push ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
run: docker push ${{ vars.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}

- name: If PR, create a new staging slot
if: ${{ github.event_name == 'pull_request' }}
Expand All @@ -58,7 +59,7 @@ jobs:
id: deploy-to-webapp
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
images: ${{ vars.DOCKER_REGISTRY }}/initializr-web:${{ env.IMAGE_TAG }}
images: ${{ vars.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
slot-name: ${{ env.SLOT_NAME }}

- name: If PR, comment with the preview link
Expand Down

0 comments on commit 09c3a70

Please sign in to comment.