This commit is contained in:
46
.gitea/workflows/helm-lint.yml
Normal file
46
.gitea/workflows/helm-lint.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
name: Helm lint
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chart-directory:
|
||||
description: |
|
||||
Root directory of the Helm chart.
|
||||
Example: `charts/my-app`.
|
||||
type: string
|
||||
default: '.'
|
||||
helm-version:
|
||||
description: |
|
||||
Helm version to install.
|
||||
Example: `v3.14.0`. Defaults to `latest`.
|
||||
type: string
|
||||
default: 'latest'
|
||||
runs-on:
|
||||
description: 'Runner label to use for the job.'
|
||||
type: string
|
||||
default: 'ubuntu-latest'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint Helm chart
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
|
||||
with:
|
||||
version: ${{ inputs.helm-version }}
|
||||
|
||||
- name: Update Helm dependencies
|
||||
run: |
|
||||
if grep -q '^dependencies:' "${{ inputs.chart-directory }}/Chart.yaml" 2>/dev/null; then
|
||||
helm dependency update "${{ inputs.chart-directory }}"
|
||||
fi
|
||||
|
||||
- name: Helm lint
|
||||
run: helm lint "${{ inputs.chart-directory }}"
|
||||
|
||||
- name: Helm template (dry-run)
|
||||
run: helm template test-release "${{ inputs.chart-directory }}" --debug > /dev/null
|
||||
110
.gitea/workflows/helm-publish.yml
Normal file
110
.gitea/workflows/helm-publish.yml
Normal file
@@ -0,0 +1,110 @@
|
||||
name: Helm publish
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
chart-directory:
|
||||
description: |
|
||||
Root directory of the Helm chart.
|
||||
Example: `charts/my-app`.
|
||||
type: string
|
||||
default: '.'
|
||||
chart-version:
|
||||
description: |
|
||||
Chart version to publish (e.g., `1.2.3`).
|
||||
If empty, the version from `Chart.yaml` is used.
|
||||
type: string
|
||||
default: ''
|
||||
required: false
|
||||
app-version:
|
||||
description: |
|
||||
Application version to embed in the chart (e.g., `1.2.3`).
|
||||
If empty, the `appVersion` from `Chart.yaml` is used.
|
||||
type: string
|
||||
default: ''
|
||||
required: false
|
||||
oci-registry:
|
||||
description: |
|
||||
OCI registry to push the chart to.
|
||||
Example: `harbor.example.com`.
|
||||
type: string
|
||||
required: true
|
||||
repository:
|
||||
description: |
|
||||
Repository path within the OCI registry.
|
||||
Example: `myorg/charts`.
|
||||
type: string
|
||||
required: true
|
||||
helm-version:
|
||||
description: |
|
||||
Helm version to install.
|
||||
Example: `v3.14.0`. Defaults to `latest`.
|
||||
type: string
|
||||
default: 'latest'
|
||||
runs-on:
|
||||
description: 'Runner label to use for the job.'
|
||||
type: string
|
||||
default: 'ubuntu-latest'
|
||||
secrets:
|
||||
OCI_REGISTRY_USERNAME:
|
||||
description: 'Username for the OCI registry.'
|
||||
required: true
|
||||
OCI_REGISTRY_PASSWORD:
|
||||
description: 'Password for the OCI registry.'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Publish Helm chart
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Setup Helm
|
||||
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
|
||||
with:
|
||||
version: ${{ inputs.helm-version }}
|
||||
|
||||
- name: Override chart version
|
||||
if: ${{ inputs.chart-version != '' }}
|
||||
run: |
|
||||
sed -i "s/^version:.*/version: ${{ inputs.chart-version }}/" \
|
||||
"${{ inputs.chart-directory }}/Chart.yaml"
|
||||
echo "Chart version set to: ${{ inputs.chart-version }}"
|
||||
|
||||
- name: Override app version
|
||||
if: ${{ inputs.app-version != '' }}
|
||||
run: |
|
||||
sed -i "s/^appVersion:.*/appVersion: \"${{ inputs.app-version }}\"/" \
|
||||
"${{ inputs.chart-directory }}/Chart.yaml"
|
||||
echo "App version set to: ${{ inputs.app-version }}"
|
||||
|
||||
- name: Update Helm dependencies
|
||||
run: |
|
||||
if grep -q '^dependencies:' "${{ inputs.chart-directory }}/Chart.yaml" 2>/dev/null; then
|
||||
helm dependency update "${{ inputs.chart-directory }}"
|
||||
fi
|
||||
|
||||
- name: Login to OCI registry
|
||||
run: |
|
||||
echo "${{ secrets.OCI_REGISTRY_PASSWORD }}" | \
|
||||
helm registry login "${{ inputs.oci-registry }}" \
|
||||
--username "${{ secrets.OCI_REGISTRY_USERNAME }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Package chart
|
||||
run: |
|
||||
helm package "${{ inputs.chart-directory }}" --destination /tmp/helm-packages
|
||||
ls -la /tmp/helm-packages/
|
||||
|
||||
- name: Push chart to OCI registry
|
||||
run: |
|
||||
for pkg in /tmp/helm-packages/*.tgz; do
|
||||
echo "Pushing $pkg to oci://${{ inputs.oci-registry }}/${{ inputs.repository }}"
|
||||
helm push "$pkg" "oci://${{ inputs.oci-registry }}/${{ inputs.repository }}"
|
||||
done
|
||||
|
||||
- name: Logout from OCI registry
|
||||
if: always()
|
||||
run: helm registry logout "${{ inputs.oci-registry }}"
|
||||
16
.gitea/workflows/release.yaml
Normal file
16
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
name: semantic-release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: https://gitea.ldpt.fr/actions/semantic-release/.github/workflows/semantic-release.yml@v2.0.0
|
||||
12
release.config.js
Normal file
12
release.config.js
Normal file
@@ -0,0 +1,12 @@
|
||||
module.exports = {
|
||||
branches: ["main", "master"],
|
||||
tagFormat: "v${version}",
|
||||
plugins: [
|
||||
[
|
||||
"@semantic-release/commit-analyzer",
|
||||
{
|
||||
preset: "conventionalcommits"
|
||||
}
|
||||
],
|
||||
]
|
||||
};
|
||||
Reference in New Issue
Block a user