Files
slashroot-cc/.gitea/workflows/deploy.yaml
Raul Costa 2d644a1ec3
Some checks failed
Build and Update Flux / build-push-update (push) Failing after 43s
RC: (debug) workflow not pushing to chart
2026-04-02 01:18:16 +01:00

77 lines
2.3 KiB
YAML

name: Build and Update Flux
on:
push:
branches:
- main
paths-ignore:
# CRITICAL: Do not trigger this action if we are just updating the Helm chart,
# otherwise it will create an infinite loop!
- "helm/**"
env:
REGISTRY: git.h0melab.uk
IMAGE_NAME: git.h0melab.uk/rgcosta/slashroot-cc
# Change this to your actual Gitea username / infra repo name
INFRA_REPO: h0melab/infra-cluster-fluxcd
jobs:
build-push-update:
runs-on: docker
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Log in to Gitea Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ gitea.sha }}
${{ env.IMAGE_NAME }}:latest
- name: Checkout Infra Repository
uses: actions/checkout@v3
with:
repository: ${{ env.INFRA_REPO }}
token: ${{ secrets.INFRA_REPO_TOKEN }}
path: infra-workspace
- name: Update Helm values.yaml for Flux
run: |
cd infra-workspace
echo "--- TARGET FILE BEFORE ---"
cat charts/slashroot/values.yaml
# The sed command (Make sure the path matches perfectly!)
sed -i "s/tag: .*/tag: ${{ gitea.sha }}/g" charts/slashroot/values.yaml
echo "--- TARGET FILE AFTER ---"
cat charts/slashroot/values.yaml
# Set up Git
git config user.name "Gitea Actions Bot"
git config user.email "actions@gitea.local"
git add charts/slashroot/values.yaml
# Check if there are actually changes to commit
if git diff --staged --quiet; then
echo "❌ ERROR: No changes were made! Check if 'tag: ' actually exists in your values.yaml"
exit 1
else
echo "✅ Changes detected! Committing and pushing..."
git commit -m "chore: deploy slashroot-cc update ${{ gitea.sha }} [skip ci]"
git push origin main
fi