Skip to content

Commit e516e91

Browse files
committed
Ref staging branch when pulling
1 parent 5f23d0f commit e516e91

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.github/workflows/gitops-staging.yaml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,17 @@ jobs:
218218
repository: ${{ env.GITOPS_REPO }}
219219
token: ${{ secrets.GITOPS_TOKEN }}
220220
path: gitops-repo
221+
ref: ${{ env.GITOPS_BRANCH }}
222+
223+
- name: Setup GitOps Branch
224+
run: |
225+
cd gitops-repo
226+
git config --local user.email "[email protected]"
227+
git config --local user.name "GitHub Action"
228+
229+
# Ensure we're on the staging branch and it's up to date
230+
git checkout ${{ env.GITOPS_BRANCH }}
231+
git pull origin ${{ env.GITOPS_BRANCH }}
221232
222233
- name: Update Helm Values for Staging
223234
run: |
@@ -227,15 +238,13 @@ jobs:
227238
228239
# Update dashboard image tag (if it exists in values)
229240
if grep -q "dashboard:" gitops-repo/infra/helm/gram/values-dev.yaml; then
230-
sed -i "s|tag: sha-[a-f0-9]*|tag: ${{ needs.build-and-deploy-dashboard.outputs.server-image-tag }}|g" \
241+
sed -i "s|tag: sha-[a-f0-9]*|tag: ${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}|g" \
231242
gitops-repo/infra/helm/gram/values-dev.yaml
232243
fi
233244
234245
- name: Commit and Push Changes
235246
run: |
236247
cd gitops-repo
237-
git config --local user.email "[email protected]"
238-
git config --local user.name "GitHub Action"
239248
git add .
240249
git commit -m "chore: update staging images to ${{ github.sha }}"
241250
git push origin ${{ env.GITOPS_BRANCH }}
@@ -257,6 +266,6 @@ jobs:
257266
- name: Notify Deployment
258267
run: |
259268
echo "🚀 Staging deployment completed!"
260-
echo "Server image: ${{ needs.build-and-deploy.outputs.server-image-tag }}"
261-
echo "Dashboard image: ${{ needs.build-and-deploy.outputs.dashboard-image-tag }}"
269+
echo "Server image: ${{ needs.build-and-deploy-server.outputs.server-image-tag }}"
270+
echo "Dashboard image: ${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}"
262271
echo "Commit: ${{ github.sha }}"

0 commit comments

Comments
 (0)