Skip to content

Commit 60cfef0

Browse files
committed
Deploy workflow partially runs on pull requests
1 parent 7892681 commit 60cfef0

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
name: deploy
22
on:
3+
pull_request:
4+
branches:
5+
- master
6+
paths:
7+
- "src/**"
8+
- "Directory.Build.props"
9+
- "Dockerfile"
10+
- ".github/workflows/deploy.yml"
311
push:
412
branches:
513
- master
@@ -35,7 +43,7 @@ jobs:
3543
uses: docker/build-push-action@v6
3644
with:
3745
context: .
38-
push: true
46+
push: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
3947
load: true
4048
pull: false
4149
no-cache: true
@@ -44,12 +52,14 @@ jobs:
4452
DOCKER_BUILD_SUMMARY: false
4553
DOCKER_BUILD_RECORD_UPLOAD: false
4654
- name: Azure login
55+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
4756
uses: azure/login@v2
4857
with:
4958
client-id: ${{ secrets.AZURE_CLIENT_ID }}
5059
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
5160
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
5261
- name: Deploy
62+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
5363
uses: azure/container-apps-deploy-action@v2
5464
with:
5565
resourceGroup: ${{ vars.RESOURCE_GROUP_NAME}}
@@ -60,4 +70,6 @@ jobs:
6070
registryUsername: ${{ secrets.DOCKERHUB_USERNAME }}
6171
registryPassword: ${{ secrets.DOCKERHUB_TOKEN }}
6272
targetPort: ${{ vars.CONTAINER_PORT }}
63-
environmentVariables: ASPNETCORE_ENVIRONMENT=Production KEY_VAULT_NAME=${{ secrets.KEY_VAULT_NAME }}
73+
environmentVariables: >
74+
ASPNETCORE_ENVIRONMENT=Production
75+
KEY_VAULT_NAME=${{ secrets.KEY_VAULT_NAME }}

0 commit comments

Comments
 (0)