forked from cartsnitch/cartsnitch
Update .gitea/workflows/ci.yml
This commit is contained in:
+60
-6
@@ -542,16 +542,43 @@ jobs:
|
|||||||
cd infra/apps/overlays/dev
|
cd infra/apps/overlays/dev
|
||||||
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.auth_tag.outputs.tag }}
|
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.auth_tag.outputs.tag }}
|
||||||
|
|
||||||
- name: Commit and push to infra
|
- name: Commit and push to infra (via PR)
|
||||||
|
env:
|
||||||
|
CI_GITEA_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd infra
|
cd infra
|
||||||
git config user.name "cartsnitch-ci[bot]"
|
git config user.name "cartsnitch-ci[bot]"
|
||||||
git config user.email "cartsnitch-ci[bot]@users.noreply.git.farh.net"
|
git config user.email "cartsnitch-ci[bot]@users.noreply.git.farh.net"
|
||||||
git add apps/overlays/dev/kustomization.yaml
|
git add apps/overlays/dev/kustomization.yaml
|
||||||
git diff --cached --quiet && echo "No image changes to deploy" && exit 0
|
git diff --cached --quiet && echo "No image changes to deploy" && exit 0
|
||||||
|
BRANCH="ci/deploy-dev-${GITHUB_SHA}"
|
||||||
|
git checkout -b "$BRANCH"
|
||||||
git commit -m "ci(dev): update cartsnitch, receiptwitness, api, and auth images"
|
git commit -m "ci(dev): update cartsnitch, receiptwitness, api, and auth images"
|
||||||
git pull --rebase origin main
|
git push origin "$BRANCH"
|
||||||
git push origin main
|
PR_BODY=$(printf 'Auto-opened by deploy-dev (CAR-1195).\n\nBuild SHA: %s' "${GITHUB_SHA}")
|
||||||
|
PR_JSON=$(curl -sS -X POST \
|
||||||
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base main --arg title "ci(dev): update overlay image tags (${GITHUB_SHA::12})" --arg body "$PR_BODY" '{head:$head,base:$base,title:$title,body:$body}')" \
|
||||||
|
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
|
||||||
|
PR_NUM=$(echo "$PR_JSON" | jq -r '.number // empty')
|
||||||
|
if [ -z "$PR_NUM" ]; then
|
||||||
|
echo "::error::Failed to open PR against cartsnitch/infra: $PR_JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Opened cartsnitch/infra PR #${PR_NUM} (head=${BRANCH})"
|
||||||
|
MERGE_RESP=$(curl -sS -X POST \
|
||||||
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"Do":"merge"}' \
|
||||||
|
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
|
||||||
|
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
|
||||||
|
if [ "$MERGED" != "true" ]; then
|
||||||
|
echo "::error::Auto-merge of cartsnitch/infra PR #${PR_NUM} failed: $MERGE_RESP"
|
||||||
|
echo "::error::Reassign to cs_savannah (authorized merger for cartsnitch/infra main) for backstop merge."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PR #${PR_NUM} merged into cartsnitch/infra main"
|
||||||
|
|
||||||
deploy-uat:
|
deploy-uat:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -641,13 +668,40 @@ jobs:
|
|||||||
cd infra/apps/overlays/uat
|
cd infra/apps/overlays/uat
|
||||||
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.auth_tag.outputs.tag }}
|
kustomize edit set image ghcr.io/cartsnitch/auth=git.farh.net/cartsnitch/auth:${{ steps.auth_tag.outputs.tag }}
|
||||||
|
|
||||||
- name: Commit and push to infra
|
- name: Commit and push to infra (via PR)
|
||||||
|
env:
|
||||||
|
CI_GITEA_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
cd infra
|
cd infra
|
||||||
git config user.name "cartsnitch-ci[bot]"
|
git config user.name "cartsnitch-ci[bot]"
|
||||||
git config user.email "cartsnitch-ci[bot]@users.noreply.git.farh.net"
|
git config user.email "cartsnitch-ci[bot]@users.noreply.git.farh.net"
|
||||||
git add apps/overlays/uat/kustomization.yaml
|
git add apps/overlays/uat/kustomization.yaml
|
||||||
git diff --cached --quiet && echo "No image changes to deploy" && exit 0
|
git diff --cached --quiet && echo "No image changes to deploy" && exit 0
|
||||||
|
BRANCH="ci/deploy-uat-${GITHUB_SHA}"
|
||||||
|
git checkout -b "$BRANCH"
|
||||||
git commit -m "ci(uat): update cartsnitch, receiptwitness, api, and auth images"
|
git commit -m "ci(uat): update cartsnitch, receiptwitness, api, and auth images"
|
||||||
git pull --rebase origin main
|
git push origin "$BRANCH"
|
||||||
git push origin main
|
PR_BODY=$(printf 'Auto-opened by deploy-uat (CAR-1195).\n\nBuild SHA: %s' "${GITHUB_SHA}")
|
||||||
|
PR_JSON=$(curl -sS -X POST \
|
||||||
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$(jq -n --arg head "cartsnitch:${BRANCH}" --arg base main --arg title "ci(uat): update overlay image tags (${GITHUB_SHA::12})" --arg body "$PR_BODY" '{head:$head,base:$base,title:$title,body:$body}')" \
|
||||||
|
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls")
|
||||||
|
PR_NUM=$(echo "$PR_JSON" | jq -r '.number // empty')
|
||||||
|
if [ -z "$PR_NUM" ]; then
|
||||||
|
echo "::error::Failed to open PR against cartsnitch/infra: $PR_JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Opened cartsnitch/infra PR #${PR_NUM} (head=${BRANCH})"
|
||||||
|
MERGE_RESP=$(curl -sS -X POST \
|
||||||
|
-H "Authorization: token ${CI_GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{"Do":"merge"}' \
|
||||||
|
"https://git.farh.net/api/v1/repos/cartsnitch/infra/pulls/${PR_NUM}/merge")
|
||||||
|
MERGED=$(echo "$MERGE_RESP" | jq -r '.merged // false')
|
||||||
|
if [ "$MERGED" != "true" ]; then
|
||||||
|
echo "::error::Auto-merge of cartsnitch/infra PR #${PR_NUM} failed: $MERGE_RESP"
|
||||||
|
echo "::error::Reassign to cs_savannah (authorized merger for cartsnitch/infra main) for backstop merge."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PR #${PR_NUM} merged into cartsnitch/infra main"
|
||||||
|
|||||||
Reference in New Issue
Block a user