fix(ci): use GITOPS_PAT for gitops push, not never-configured SSH secrets
Some checks failed
build-and-release / build (push) Failing after 1m34s
Some checks failed
build-and-release / build (push) Failing after 1m34s
Same fix as nxtgauge-frontend-solid: GITEOPS_REPO/GITEOPS_SSH_KEY were never configured as repo secrets. Switch to an HTTPS clone with GITOPS_PAT, matching nxtgauge-backend-rust's already-working workflow.
This commit is contained in:
parent
7f4351550a
commit
697a4b0d92
1 changed files with 15 additions and 13 deletions
|
|
@ -98,22 +98,24 @@ jobs:
|
||||||
|
|
||||||
- name: Update GitOps release
|
- name: Update GitOps release
|
||||||
env:
|
env:
|
||||||
GITEOPS_REPO: ${{ secrets.GITEOPS_REPO }}
|
GITOPS_SERVER: ${{ secrets.GITOPS_SERVER || 'ci.nxtgauge.com' }}
|
||||||
GITEOPS_SSH_KEY: ${{ secrets.GITEOPS_SSH_KEY }}
|
GITOPS_OWNER: ${{ secrets.GITOPS_OWNER || 'ashwin' }}
|
||||||
|
GITOPS_REPO: ${{ secrets.GITOPS_REPO || 'nxtgauge-gitops' }}
|
||||||
|
GITOPS_BRANCH: ${{ secrets.GITOPS_BRANCH || 'main' }}
|
||||||
|
# The gitops repo lives on Forgejo (ci.nxtgauge.com), not GitHub -
|
||||||
|
# GITEOPS_REPO/GITEOPS_SSH_KEY were never actually configured as
|
||||||
|
# repo secrets (only GITOPS_GITHUB_* and GITOPS_PAT exist, per
|
||||||
|
# nxtgauge-backend-rust's already-fixed workflow). Use GITOPS_PAT.
|
||||||
|
GITOPS_PAT: ${{ secrets.GITOPS_PAT }}
|
||||||
SHA: ${{ github.sha }}
|
SHA: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
test -n "$GITEOPS_REPO"
|
test -n "${GITOPS_PAT:-}" || { echo "GITOPS_PAT is empty"; exit 1; }
|
||||||
test -n "$GITEOPS_SSH_KEY"
|
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
GITOPS_DIR=$(mktemp -d)
|
||||||
printf '%s\n' "$GITEOPS_SSH_KEY" > ~/.ssh/id_ed25519
|
git clone "https://forgejo-actions:${GITOPS_PAT}@${GITOPS_SERVER}/${GITOPS_OWNER}/${GITOPS_REPO}.git" "$GITOPS_DIR"
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
cd "$GITOPS_DIR"
|
||||||
for host in github.com ci.nxtgauge.com; do ssh-keyscan -H "$host" >> ~/.ssh/known_hosts 2>/dev/null || true; done
|
git checkout "$GITOPS_BRANCH"
|
||||||
|
|
||||||
GITEOPS_DIR=$(mktemp -d)
|
|
||||||
git clone "$GITEOPS_REPO" "$GITEOPS_DIR"
|
|
||||||
cd "$GITEOPS_DIR"
|
|
||||||
|
|
||||||
image_ref="$(cat /tmp/admin-solid-image-ref.txt)"
|
image_ref="$(cat /tmp/admin-solid-image-ref.txt)"
|
||||||
./scripts/set-app-release.sh admin-solid "$image_ref"
|
./scripts/set-app-release.sh admin-solid "$image_ref"
|
||||||
|
|
@ -127,4 +129,4 @@ jobs:
|
||||||
git config user.email "forgejo-actions@ci.nxtgauge.com"
|
git config user.email "forgejo-actions@ci.nxtgauge.com"
|
||||||
git add apps scripts/set-app-release.sh
|
git add apps scripts/set-app-release.sh
|
||||||
git commit -m "chore(gitops): deploy admin-solid@${SHA}"
|
git commit -m "chore(gitops): deploy admin-solid@${SHA}"
|
||||||
git push
|
git push origin "HEAD:${GITOPS_BRANCH}"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue