Skip to content

Commit 2ca5276

Browse files
committed
fix: avoid gitops for packages that don't have dockerfile
1 parent 06a9188 commit 2ca5276

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/gitops.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,39 @@ jobs:
2323
matrix:
2424
packages: ${{ fromJson(inputs.packages_deployment) }}
2525

26+
outputs:
27+
DOCKERFILE_EXISTS: ${{ steps.check-dockerfile.outputs.DOCKERFILE_EXISTS }}
28+
2629
steps:
2730
- name: checkout
31+
uses: action/checkout
32+
33+
- name: Check if Dockerfile exists
34+
id: check-dockerfile
35+
run: |
36+
if [ ! -f apps/${{ matrix.packages.name }}/Dockerfile ]; then
37+
echo "Dockerfile does not exist"
38+
echo "DOCKERFILE_EXISTS=false" >> $GITHUB_OUTPUT
39+
else
40+
echo "Dockerfile exists"
41+
echo "DOCKERFILE_EXISTS=true" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: checkout
45+
if: steps.check-dockerfile.outputs.DOCKERFILE_EXISTS == 'true'
2846
uses: actions/checkout@v3
2947
with:
3048
repository: stamford-syntax-club/infra
3149
fetch-depth: 0
3250
token: ${{ secrets.workflow_token }}
3351

3452
- name: create and checkout new branch
53+
if: steps.check-dockerfile.outputs.DOCKERFILE_EXISTS == 'true'
3554
run: |
3655
git checkout -b deploy/${{ inputs.environment }}/coursecompose/${{ matrix.packages.name }}/${{ github.sha }}
56+
3757
- name: change image tag
58+
if: steps.check-dockerfile.outputs.DOCKERFILE_EXISTS == 'true'
3859
run: |
3960
git config user.name "${{ github.actor }}"
4061
git config user.email "${{ github.actor }}@stamford.dev"

0 commit comments

Comments
 (0)