Skip to content

Commit

Permalink
Merge pull request #104 from shaneknapp/update-push-workflow
Browse files Browse the repository at this point in the history
 [DH-301] use new workflow to create datahub PR after image is built and pushed
  • Loading branch information
shaneknapp authored Oct 25, 2024
2 parents 28a3261 + 057cf15 commit 9e36efe
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build and push container image, and push update to datahub repo if needed
on:
workflow_dispatch:
push:
branches:
- main
Expand Down Expand Up @@ -96,14 +97,14 @@ jobs:
- name: Update the tag for any deployments that use this image
if: ${{ env.IMAGE_TAG }}
run: |
for deployment in $(grep -lr ${IMAGE} deployments/ | grep hubploy.yaml); do
for deployment in $(grep -lr ${IMAGE} deployments/); do
old_hash=$(grep ${IMAGE} ${deployment} | awk -F":" '{print $3}')
new_hash=${IMAGE_TAG}
sed -i -e "s,${IMAGE}:${old_hash},${IMAGE}:${new_hash},g" ${deployment}
echo "Updated ${deployment} with new image tag ${new_hash}"
done
- name: Create feature branch, add, commit and push changes
- name: Create feature branch, add, commit, push changes and open a pull request
if: ${{ env.IMAGE_TAG }}
env:
GH_TOKEN: ${{ secrets.DATAHUB_CREATE_PR }}
Expand All @@ -130,6 +131,7 @@ jobs:
EOF
BODY=$(cat ${HOME}/pr-body.txt)
gh pr new -t "${MESSAGE}" -b "${BODY}" -H${BRANCH} -Bstaging
- name: Print out a message if no PR is created
if: ${{ ! env.IMAGE_TAG }}
run: |
Expand Down

0 comments on commit 9e36efe

Please sign in to comment.