Port CI to Forgejo Actions
All checks were successful
ci / build (push) Successful in 6m6s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Successful in 38s
ci / chart (push) Successful in 0s
ci / frontend-test (push) Successful in 42s
ci / build-1 (push) Successful in 2m14s
ci / frontend-docker (push) Successful in 0s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Jonas Leder 2026-11-18 10:12:14 +01:00
commit e0abf17ed0
2 changed files with 54 additions and 75 deletions

54
.forgejo/workflows/ci.yml Normal file
View file

@ -0,0 +1,54 @@
name: ci
on:
push:
branches: ['**']
tags: ['**']
workflow_dispatch:
jobs:
frontend-test:
runs-on: default
steps:
- uses: https://code.forgejo.org/actions/checkout@v7
- uses: https://code.forgejo.org/actions/setup-node@v7
with:
node-version: '24.22'
- run: |
set -eu
corepack enable
cd frontend
yarn install --immutable
yarn test
backend-docker:
uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
with:
image-suffix: /backend
additional-args: --opt filename=Dockerfile.backend
secrets: inherit
frontend-docker:
uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
with:
image-suffix: /frontend
additional-args: --opt filename=Dockerfile.frontend
secrets: inherit
# helm install ffk-timetracker oci://forgejo.jonasled.dev/<owner>/ffk-timetracker/charts/ffk-timetracker --version <version>
chart:
needs: [backend-docker, frontend-docker]
if: github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch
uses: infra/ci-snippets/.forgejo/workflows/helm-build.yml@master
with:
chart-path: helm
push: true
# Flux picks the highest version: patch is run number plus the last GitLab pipeline (617).
version-from-run-number: true
version-offset: '617'
pre-package: |
set -eu
IMAGE="$REGISTRY/$(echo "$GITHUB_REPOSITORY" | tr 'A-Z' 'a-z')"
f=helm/values.yaml
sed -i "s|repository: jonasled.dev/jonasled/ffk-timetracker/|repository: $IMAGE/|; s/^ tag: .*/ tag: $GITHUB_SHA/" "$f"
secrets: inherit

View file

@ -1,75 +0,0 @@
stages:
- test
- build
- bundle
FrontendTest:
image: node:24.22-alpine@sha256:116b800c3754b440ee0aa3ed2f20f5bf3d99a554bfd9adeea09ea8017f6e85f5
stage: test
needs: []
script:
- cd frontend
- yarn install --immutable
- yarn test
BackendDocker:
image: jonasled.dev/infra/docker-build:master@sha256:d6f535fcb2817edec221eac33331369863f3409322d5f2d516356e7e7554326b
stage: build
needs: []
script:
- export IMAGE_NAME=$CI_REGISTRY_IMAGE/backend
- export BUILDKIT_ADDITIONAL_ARGS="--opt filename=Dockerfile.backend"
- build-image
- mv image-hash.txt image-hash-backend.txt
- mv image-scan-report.bom.json backend.bom.json
artifacts:
paths:
- image-hash-backend.txt
- backend.bom.json
FrontendDocker:
image: jonasled.dev/infra/docker-build:master@sha256:d6f535fcb2817edec221eac33331369863f3409322d5f2d516356e7e7554326b
stage: build
needs: []
script:
- export IMAGE_NAME=$CI_REGISTRY_IMAGE/frontend
- export BUILDKIT_ADDITIONAL_ARGS="--opt filename=Dockerfile.frontend"
- build-image
- mv image-hash.txt image-hash-frontend.txt
- mv image-scan-report.bom.json frontend.bom.json
artifacts:
paths:
- image-hash-frontend.txt
- frontend.bom.json
HelmChart:
# Packages the chart and pushes it to the project's OCI registry:
# helm install ffk-timetracker oci://$CI_REGISTRY/$CI_PROJECT_PATH/charts/ffk-timetracker --version <version>
image:
name: alpine/helm:4.3.2
entrypoint: [""]
stage: bundle
needs:
- BackendDocker
- FrontendDocker
variables:
CHART_DIR: helm
CHART_REPO: oci://$CI_REGISTRY/$CI_PROJECT_PATH/charts
script:
- helm dependency update "$CHART_DIR"
- 'sed -i "s/^ tag: .*/ tag: $CI_COMMIT_SHA/" "$CHART_DIR/values.yaml"'
- 'sed -i "s/^ release: .*/ release: \"$CI_PIPELINE_ID\"/" "$CHART_DIR/values.yaml"'
- helm lint "$CHART_DIR"
- |
# Flux picks the highest version, so versions must only grow: patch = pipeline IID.
BASE_VERSION=$(sed -n 's/^version: *//p' "$CHART_DIR/Chart.yaml" | cut -d. -f1,2)
helm package "$CHART_DIR" --version "${BASE_VERSION}.${CI_PIPELINE_IID}" --destination dist
- helm registry login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- helm push dist/ffk-timetracker-*.tgz "$CHART_REPO"
rules:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
artifacts:
paths:
- dist/