Files
buildpath/.gitea/workflows/pipeline.yaml
T
vhaudiquet ff9d88d582
pipeline / lint-and-format (push) Successful in 4m1s
pipeline / build-and-push-images (push) Successful in 2m8s
pipeline / lint-and-publish-chart (push) Successful in 11s
helm: add helm chart
2026-07-26 16:12:17 +02:00

124 lines
4.0 KiB
YAML

name: pipeline
on:
push:
branches:
- "main"
permissions:
packages: write
jobs:
lint-and-format:
runs-on: ubuntu-latest
container:
image: ubuntu:25.10
steps:
- name: Install node and npm
run: apt-get update && apt-get install -y nodejs npm
- name: Checkout repository
uses: https://gitea.com/actions/checkout@v4
- name: Install dependencies for frontend
working-directory: ./frontend
run: npm ci
- name: Lint frontend
working-directory: ./frontend
run: npm run lint
- name: Check formatting for frontend
working-directory: ./frontend
run: npm run format:check
- name: Install dependencies for match_collector
working-directory: ./match_collector
run: npm ci
- name: Lint match_collector
working-directory: ./match_collector
run: npm run lint
- name: Check formatting for match_collector
working-directory: ./match_collector
run: npm run format:check
build-and-push-images:
needs: lint-and-format
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: https://gitea.com/actions/checkout@v4
- name: Log in to container registry
uses: docker/login-action@v3
with:
registry: https://git.vhaudiquet.fr
username: ${{ github.actor }}
password: ${{ secrets.PACKAGES_TOKEN }}
- name: Build and push frontend docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./frontend/Dockerfile
push: true
tags: |
git.vhaudiquet.fr/vhaudiquet/lolstats-frontend:latest
git.vhaudiquet.fr/vhaudiquet/lolstats-frontend:${{ github.sha }}
- name: Build and push match_collector docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./match_collector/Dockerfile
push: true
tags: |
git.vhaudiquet.fr/vhaudiquet/lolstats-match_collector:latest
git.vhaudiquet.fr/vhaudiquet/lolstats-match_collector:${{ github.sha }}
lint-and-publish-chart:
runs-on: ubuntu-latest
needs: build-and-push-images
steps:
- name: Checkout repository
uses: https://gitea.com/actions/checkout@v4
with:
fetch-depth: 0
- name: Install Helm
uses: azure/setup-helm@v5
- name: Update Chart version and appVersion
run: |
# Get base chart version from Chart.yaml
BASE_VERSION=$(grep '^version:' helm/buildpath/Chart.yaml | awk '{print $2}')
# Use timestamp for ordered versions (e.g., 0.1.0-20240511-130400)
# Note: SemVer pre-release cannot contain dots, only hyphens and alphanumerics
TIMESTAMP=$(date -u +"%Y%m%d-%H%M%S")
CHART_VERSION="${BASE_VERSION}-${TIMESTAMP}"
# Update both version and appVersion
sed -i "s/^version:.*/version: \"${CHART_VERSION}\"/" helm/buildpath/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${{ github.sha }}\"/" helm/buildpath/Chart.yaml
echo "chart_version=${CHART_VERSION}" >> $GITHUB_ENV
- name: Lint Helm chart
run: helm lint helm/buildpath/
- name: Package Helm chart
run: |
helm package helm/buildpath/ \
--version "${{ env.chart_version }}" \
--app-version "${{ github.sha }}"
- name: Push Helm chart to Gitea registry
run: |
echo "Uploading chart to Gitea registry..."
echo "User: ${{ github.actor }}"
echo "URL: https://git.vhaudiquet.fr/api/packages/vhaudiquet/helm/api/charts"
# Trim any trailing newline from the token
TOKEN=$(echo -n "${{ secrets.PACKAGES_TOKEN }}" | tr -d '\n')
curl --fail -v --user "${{ github.actor }}:${TOKEN}" -X POST --upload-file buildpath-*.tgz "https://git.vhaudiquet.fr/api/packages/vhaudiquet/helm/api/charts"