ci(forgejo): update frontend build pipeline
Some checks failed
build-and-push / build (push) Failing after 20s

This commit is contained in:
Ashwin Kumar Sivakumar 2026-07-03 19:51:38 +05:30
parent dc130dce32
commit 38cb9eefb0

View file

@ -18,30 +18,29 @@ jobs:
- name: Install Docker CLI - name: Install Docker CLI
run: | run: |
apt-get update apt-get update
apt-get install -y docker.io apt-get install -y docker.io git python3
- name: Log in to registry - name: Log in to registry
run: | run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.nxtgauge.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login ci.nxtgauge.com -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
- name: Build and push frontend image - name: Build and push frontend image
run: | run: |
set -euo pipefail set -euo pipefail
IMAGE="registry.nxtgauge.com/nxtgauge-frontend-solid:${{ github.sha }}" IMAGE="ci.nxtgauge.com/ashwin/nxtgauge-frontend-solid:${{ github.sha }}"
docker build -t "${IMAGE}" -t registry.nxtgauge.com/nxtgauge-frontend-solid:latest . docker build -t "${IMAGE}" .
docker push "${IMAGE}" docker push "${IMAGE}"
docker push registry.nxtgauge.com/nxtgauge-frontend-solid:latest
update-gitops: update-gitops:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update GitOps frontend tag - name: Update GitOps frontend release
env: env:
GITOPS_USERNAME: ${{ secrets.GITOPS_GITHUB_USERNAME || 'Traceworks2023' }} GITOPS_USERNAME: ${{ secrets.GITOPS_GITHUB_USERNAME || 'Traceworks2023' }}
GITOPS_PASSWORD: ${{ secrets.GITOPS_GITHUB_TOKEN || secrets.GITOPS_PAT }} GITOPS_PASSWORD: ${{ secrets.GITOPS_GITHUB_TOKEN || secrets.GITOPS_PAT }}
GITOPS_REPO: https://github.com/Traceworks2023/nxtgauge-gitops.git GITOPS_REPO: https://github.com/Traceworks2023/nxtgauge-gitops.git
IMAGE_TAG: ${{ github.sha }} IMAGE_REF: ci.nxtgauge.com/ashwin/nxtgauge-frontend-solid:${{ github.sha }}
run: | run: |
set -euo pipefail set -euo pipefail
test -n "${GITOPS_PASSWORD:-}" || { echo "GITOPS_PASSWORD is empty"; exit 1; } test -n "${GITOPS_PASSWORD:-}" || { echo "GITOPS_PASSWORD is empty"; exit 1; }
@ -49,23 +48,10 @@ jobs:
TMP_DIR="$(mktemp -d)" TMP_DIR="$(mktemp -d)"
git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" clone --branch main "${GITOPS_REPO}" "${TMP_DIR}" git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" clone --branch main "${GITOPS_REPO}" "${TMP_DIR}"
cd "${TMP_DIR}" cd "${TMP_DIR}"
python3 - <<'PY' ./scripts/set-app-release.sh frontend-solid "${IMAGE_REF}"
from pathlib import Path
import os
path = Path('apps/nxtgauge-frontend-solid/overlays/prod/kustomization.yaml')
lines = path.read_text().splitlines()
out = []
for line in lines:
if line.strip().startswith('newTag:'):
indent = line[:len(line) - len(line.lstrip())]
out.append(f"{indent}newTag: {os.environ['IMAGE_TAG']}")
else:
out.append(line)
path.write_text('\n'.join(out) + '\n')
PY
git config user.name "forgejo-actions" git config user.name "forgejo-actions"
git config user.email "forgejo-actions@nxtgauge.com" git config user.email "forgejo-actions@nxtgauge.com"
git add apps/nxtgauge-frontend-solid/overlays/prod/kustomization.yaml git add apps/nxtgauge-frontend-solid/overlays/prod/release-patch.yaml
git diff --cached --quiet && exit 0 git diff --cached --quiet && exit 0
git commit -m "chore(gitops): update frontend image to ${IMAGE_TAG}" git commit -m "chore(gitops): deploy frontend-solid@${{ github.sha }}"
git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push origin main git -c http.extraHeader="AUTHORIZATION: basic ${AUTH}" push origin main