64 lines
1.9 KiB
YAML
64 lines
1.9 KiB
YAML
# Woodpecker CI - Frontend build + GitOps update
|
|
#
|
|
# Secrets required:
|
|
# - REGISTRY_HOSTPORT, REGISTRY_USERNAME, REGISTRY_PASSWORD (existing)
|
|
# - GITOPS_REPO_URL, GITOPS_BRANCH, GITOPS_TOKEN, GITOPS_USERNAME, GITOPS_EMAIL
|
|
|
|
when:
|
|
branch: [main, high-performance]
|
|
event: push
|
|
|
|
steps:
|
|
- name: build-and-push
|
|
image: woodpeckerci/plugin-kaniko:2.1.1
|
|
settings:
|
|
registry: registry.nxtgauge.com:5000
|
|
repo: nxtgauge-frontend-solid
|
|
dockerfile: Dockerfile.simple
|
|
tags:
|
|
- ${CI_COMMIT_SHA}
|
|
- latest
|
|
- high-performance-latest
|
|
username:
|
|
from_secret: REGISTRY_USERNAME
|
|
password:
|
|
from_secret: REGISTRY_PASSWORD
|
|
insecure: true
|
|
insecure_pull: true
|
|
skip_tls_verify: true
|
|
platforms: linux/amd64
|
|
cache: false
|
|
|
|
- name: update-gitops
|
|
image: alpine/git:latest
|
|
commands:
|
|
- |
|
|
set -e
|
|
|
|
echo "Updating GitOps for nxtgauge-frontend-solid"
|
|
|
|
git clone https://github.com/Traceworks2023/nxtgauge-gitops.git /tmp/gitops
|
|
cd /tmp/gitops
|
|
git checkout main
|
|
|
|
# Update frontend overlay
|
|
FRONTEND_OVERLAY="apps/nxtgauge-frontend-solid/overlays/prod"
|
|
if [ -f "${FRONTEND_OVERLAY}/kustomization.yaml" ]; then
|
|
sed -i "s|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:.*|image: registry.nxtgauge.com:5000/nxtgauge-frontend-solid:${CI_COMMIT_SHA}|" \
|
|
${FRONTEND_OVERLAY}/kustomization.yaml
|
|
echo "Updated frontend image to ${CI_COMMIT_SHA}"
|
|
fi
|
|
|
|
# Commit and push
|
|
if ! git diff --quiet; then
|
|
git config user.name "Woodpecker CI"
|
|
git config user.email "woodpecker@nxtgauge.com"
|
|
git add -A
|
|
git commit -m "ci: update nxtgauge-frontend-solid to ${CI_COMMIT_SHA:0:8}"
|
|
git push origin main
|
|
echo "Pushed GitOps update"
|
|
else
|
|
echo "No changes to push"
|
|
fi
|
|
when:
|
|
status: success
|