Port CI to Forgejo Actions
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a94b37ca0
commit
65a76b3afc
2 changed files with 26 additions and 39 deletions
26
.forgejo/workflows/ci.yml
Normal file
26
.forgejo/workflows/ci.yml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ['**']
|
||||
tags: ['**']
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
|
||||
secrets: inherit
|
||||
|
||||
helm:
|
||||
needs: [docker]
|
||||
if: github.ref_name == github.event.repository.default_branch
|
||||
uses: infra/ci-snippets/.forgejo/workflows/helm-build.yml@master
|
||||
with:
|
||||
chart-path: charts/shelly-prometheus-exporter
|
||||
push: true
|
||||
version-from-run-number: true
|
||||
version-offset: '17'
|
||||
pre-package: |
|
||||
sed -i "s#^ repository: .*# repository: $REGISTRY/$(echo "$GITHUB_REPOSITORY" | tr 'A-Z' 'a-z')#" charts/shelly-prometheus-exporter/values.yaml
|
||||
sed -i "s/^ tag: .*/ tag: $GITHUB_SHA/" charts/shelly-prometheus-exporter/values.yaml
|
||||
secrets: inherit
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
stages:
|
||||
- build
|
||||
- bundle
|
||||
- deploy
|
||||
|
||||
include:
|
||||
- project: 'infra/ci'
|
||||
file: '/pipelines/docker.yml'
|
||||
|
||||
Helm:
|
||||
stage: bundle
|
||||
image: alpine:latest
|
||||
dependencies:
|
||||
- Docker
|
||||
before_script:
|
||||
- apk add curl bash openssl git
|
||||
- curl -L https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4 | bash
|
||||
script:
|
||||
- helm dependency update charts/shelly-prometheus-exporter
|
||||
|
||||
- "export NEXT_PATCH_VERSION=\"$(cat charts/shelly-prometheus-exporter/Chart.yaml | grep ^version: | cut -d ' ' -f 2 | awk -F. '{print $1 \".\" $2 \".\"}')\""
|
||||
- "sed -i \"s/^ tag: .*/ tag: $CI_COMMIT_SHA/\" charts/shelly-prometheus-exporter/values.yaml"
|
||||
- helm lint charts/shelly-prometheus-exporter
|
||||
- helm package charts/shelly-prometheus-exporter --version "${NEXT_PATCH_VERSION}${CI_PIPELINE_IID}"
|
||||
artifacts:
|
||||
paths:
|
||||
- shelly-prometheus-exporter-*.tgz
|
||||
|
||||
Deploy Helm:
|
||||
image: alpine/helm:latest
|
||||
stage: deploy
|
||||
script:
|
||||
- HELM_TGZ=$(ls shelly-prometheus-exporter-*.tgz)
|
||||
- echo "$CI_REGISTRY_PASSWORD" | helm registry login "$CI_REGISTRY" --username "$CI_REGISTRY_USER" --password-stdin
|
||||
- helm push "${HELM_TGZ}" "oci://${CI_REGISTRY_IMAGE}/helm"
|
||||
dependencies:
|
||||
- Helm
|
||||
rules:
|
||||
- if: $CI_COMMIT_BRANCH == "master"
|
||||
Loading…
Add table
Add a link
Reference in a new issue