Skip to content

Commit

Permalink
Fixes and commit step
Browse files Browse the repository at this point in the history
  • Loading branch information
TBeijen committed Jul 24, 2024
1 parent 0d2d204 commit e28ff7e
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,10 @@ jobs:
needs:
- build
steps:
- name: GitOps Checkout
uses: actions/checkout@v4
with:
repository: tbeijen/tbnl-www-gitops
ref: main
token: ${{ secrets.TBNL_BOT_PAT }}
fetch-depth: 0
path: tbnl-www-gitops

- name: Extract sha tag
id: extract-sha-tag
id: extract_sha_tag
run: |
tags="${{ needs.build.outputs.docker_image_tags }}""
tags="${{ needs.build.outputs.docker_image_tags }}"
echo "Docker image tags:"
echo "$tags"
sha_tag=$(echo "$tags" | grep -oE 'sha-[^ ]+')
Expand All @@ -93,3 +84,31 @@ jobs:
echo "::set-output name=sha_tag::$sha_tag"
fi
- name: GitOps Checkout
uses: actions/checkout@v4
with:
repository: tbeijen/tbnl-www-gitops
ref: main
token: ${{ secrets.TBNL_BOT_PAT }}
fetch-depth: 0
path: tbnl-www-gitops

- name: GitOps update
run: |
git -C tbnl-www-gitops config user.name "TBNL bot"
git -C tbnl-www-gitops config user.email "[email protected]"
new_sha_tag="${{ steps.extract_sha_tag.outputs.sha_tag}}"
deployment_file="variants/www-test/version.yaml"
echo "Deployment file path: $deployment_file"
echo "Current deployment file contents:"
cat $deployment_file
sed -i.bak -E "s/(image:.*:)(sha-[a-z0-9]+)/\1${new_sha_tag}/" $deployment_file
echo "Modified deployment file contents:"
cat $deployment_file
git -C tbnl-www-gitops commit -am "Updated www test to ${{ steps.extract-sha-tag.outputs.sha_tag}}"
git -C tbnl-www-gitops push origin main

0 comments on commit e28ff7e

Please sign in to comment.