Compare commits
1 Commits
main
...
feat-push-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
054a354666 |
37
.gitea/actions/helm-chart-push/README.md
Normal file
37
.gitea/actions/helm-chart-push/README.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# helm-chart-push
|
||||||
|
|
||||||
|
A Gitea Action for pushing Helm charts to Gitea's built-in Helm registry. This action simplifies the process of publishing Helm charts to your Gitea instance's package registry.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Inputs
|
||||||
|
|
||||||
|
| Input | Required | Description | Default |
|
||||||
|
|-------|----------|-------------|---------|
|
||||||
|
| `registry-token` | true | The Bearer token for authenticating with the Gitea Helm Registry | - |
|
||||||
|
| `chart-path` | true | The local path to the Helm chart file (`.tgz` archive) | - |
|
||||||
|
| `repository-owner` | true | The owner/username of the Gitea Helm Repository | - |
|
||||||
|
| `gitea-base-url` | false | The base URL of your Gitea instance | `https://gitea.t000-n.de` |
|
||||||
|
|
||||||
|
### Basic Example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: Push Helm Chart
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push-chart:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: helm package ./charts/my-chart
|
||||||
|
- name: Push to Gitea Registry
|
||||||
|
uses: ./.gitea/actions/helm-chart-push
|
||||||
|
with:
|
||||||
|
registry-token: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
chart-path: ./my-chart-*.tgz
|
||||||
|
repository-owner: ${{ github.repository_owner }}
|
||||||
|
```
|
||||||
96
.gitea/actions/helm-chart-push/action.yaml
Normal file
96
.gitea/actions/helm-chart-push/action.yaml
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
name: Push Helm Chart
|
||||||
|
description: Push a Helm Chart to the Gitea Helm Repository
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
registry-token:
|
||||||
|
description: The Bearer token for the Gitea Helm Registry
|
||||||
|
required: true
|
||||||
|
chart-path:
|
||||||
|
description: The path to the Helm Chart (e.g., ./my-chart-1.0.0.tgz)
|
||||||
|
required: true
|
||||||
|
repository-owner:
|
||||||
|
description: The owner of the Gitea Helm Repository
|
||||||
|
required: true
|
||||||
|
gitea-base-url:
|
||||||
|
description: The base URL of the Gitea instance (must include protocol)
|
||||||
|
required: false
|
||||||
|
default: "https://gitea.t000-n.de"
|
||||||
|
chart-name:
|
||||||
|
description: Optional name for the chart (used for logging and validation)
|
||||||
|
required: false
|
||||||
|
timeout:
|
||||||
|
description: Timeout for the HTTP request in seconds
|
||||||
|
required: false
|
||||||
|
default: "60"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Validate inputs
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
# Validate required inputs
|
||||||
|
if [[ -z "${{ inputs.registry-token }}" ]]; then
|
||||||
|
echo "Error: registry-token is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${{ inputs.chart-path }}" ]]; then
|
||||||
|
echo "Error: chart-path is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${{ inputs.repository-owner }}" ]]; then
|
||||||
|
echo "Error: repository-owner is required"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate chart file exists
|
||||||
|
if [[ ! -f "${{ inputs.chart-path }}" ]]; then
|
||||||
|
echo "Error: Chart file not found at path: ${{ inputs.chart-path }}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate chart file is a valid tar.gz
|
||||||
|
if ! tar -tzf "${{ inputs.chart-path }}" >/dev/null 2>&1; then
|
||||||
|
echo "Error: Invalid chart file format. Must be a valid .tgz file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Validate Gitea base URL format
|
||||||
|
if [[ ! "${{ inputs.gitea-base-url }}" =~ ^https?:// ]]; then
|
||||||
|
echo "Error: gitea-base-url must include protocol (http:// or https://)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Input validation passed"
|
||||||
|
|
||||||
|
- name: Push Helm Chart
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Set variables
|
||||||
|
CHART_PATH="${{ inputs.chart-path }}"
|
||||||
|
CHART_NAME="${inputs.chart-name:-$(basename "$CHART_PATH" .tgz)}"
|
||||||
|
TIMEOUT="${{ inputs.timeout }}"
|
||||||
|
|
||||||
|
echo "Pushing Helm chart: $CHART_NAME"
|
||||||
|
|
||||||
|
# Push chart with proper error handling
|
||||||
|
RESPONSE=$(curl --fail --show-error \
|
||||||
|
--silent \
|
||||||
|
--max-time "$TIMEOUT" \
|
||||||
|
--header "Authorization: Bearer ${{ inputs.registry-token }}" \
|
||||||
|
--header "Content-Type: application/gzip" \
|
||||||
|
--header "User-Agent: GitHub-Actions-Helm-Push/1.0" \
|
||||||
|
-X POST \
|
||||||
|
--upload-file "$CHART_PATH" \
|
||||||
|
"${{ inputs.gitea-base-url }}/api/packages/${{ inputs.repository-owner }}/helm/api/charts" \
|
||||||
|
2>&1) || {
|
||||||
|
echo "Failed to push Helm chart"
|
||||||
|
echo "Response: $RESPONSE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Successfully pushed Helm chart: $CHART_NAME"
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
name: CD
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
name: Release
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Increment tag
|
|
||||||
id: tag
|
|
||||||
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@41b7e04221df8a033bec841d40a097b76e5f67ff # 0.1.29
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
- name: Push tag
|
|
||||||
uses: ./release-git-tag
|
|
||||||
with:
|
|
||||||
tag: ${{ steps.tag.outputs.new-tag }}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test_get-repo-name:
|
|
||||||
name: Test get-repo-name
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
||||||
- id: repo
|
|
||||||
uses: ./get-repo-name
|
|
||||||
- run: |
|
|
||||||
test "${{ steps.repo.outputs.name }}" = "actions" || (echo "Expected repo name 'actions', got '${{ steps.repo.outputs.name }}'" && exit 1)
|
|
||||||
- run: echo "Original repository name is ${{ GITEA_REPOSITORY }}"
|
|
||||||
@@ -1,9 +1,5 @@
|
|||||||
# actions
|
# actions
|
||||||
|
|
||||||
Collection of Gitea friendly actions.
|
Collection of Gitea friendly actions & workflows.
|
||||||
|
|
||||||
## Actions
|
* [helm-chart-push](./.gitea/actions/helm-chart-push/README.md) Push a Helm Chart into the Gitea Helm Chart Registry
|
||||||
|
|
||||||
- [get-repo-name](./get-repo-name/README.md)
|
|
||||||
- [release-git-tag](./release-git-tag/README.md)
|
|
||||||
- [release-helm-chart](./release-helm-chart/README.md)
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
# get-repo-name
|
|
||||||
|
|
||||||
Outputs the repository name from the Git/Gitea/GitHub environment without the owner.
|
|
||||||
|
|
||||||
Example: `t.behrendt/actions` → `actions`
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- id: repo
|
|
||||||
uses: https://gitea.t000-n.de/t.behrendt/actions/get-repo-name@0.0.0
|
|
||||||
- run: echo "Repository name is ${{ steps.repo.outputs.name }}"
|
|
||||||
```
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
name: Get repo name
|
|
||||||
description: Outputs the repository name without the owner (e.g. "owner/repo" → "repo")
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
name:
|
|
||||||
description: The repository name without the owner
|
|
||||||
value: ${{ steps.repo-name.outputs.name }}
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- id: repo-name
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
REPO="${GITEA_REPOSITORY:-$GITHUB_REPOSITORY}"
|
|
||||||
echo "name=${REPO##*/}" >> $GITHUB_OUTPUT
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
# release-git-tag
|
|
||||||
|
|
||||||
Creates and pushes a Git tag to the remote repository.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: ./release-git-tag
|
|
||||||
with:
|
|
||||||
tag: v1.0.0
|
|
||||||
```
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
name: Release Git tag
|
|
||||||
description: Releases a Git to origin
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: The tag to release
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- shell: bash
|
|
||||||
run: |
|
|
||||||
git tag ${{ inputs.tag }}
|
|
||||||
git push origin ${{ inputs.tag }}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
# release-helm-chart
|
|
||||||
|
|
||||||
Packages and releases a Helm chart to a Gitea Helm registry.
|
|
||||||
|
|
||||||
## Inputs
|
|
||||||
|
|
||||||
| Input | Description | Required |
|
|
||||||
| ------------------- | ----------------------------- | -------- |
|
|
||||||
| `tag` | The version tag to release | Yes |
|
|
||||||
| `name` | The name of the Helm chart | Yes |
|
|
||||||
| `registry-user` | The username for the registry | Yes |
|
|
||||||
| `registry-password` | The password for the registry | Yes |
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: ./release-helm-chart
|
|
||||||
with:
|
|
||||||
tag: v1.2.3
|
|
||||||
name: my-chart
|
|
||||||
registry-user: myuser
|
|
||||||
registry-password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
||||||
```
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
name: Release Helm chart
|
|
||||||
description: Release the Helm chart
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
tag:
|
|
||||||
description: The tag to release
|
|
||||||
required: true
|
|
||||||
name:
|
|
||||||
description: The name of the Helm chart
|
|
||||||
required: true
|
|
||||||
registry-user:
|
|
||||||
description: The username for the registry
|
|
||||||
required: true
|
|
||||||
registry-password:
|
|
||||||
description: The password for the registry
|
|
||||||
required: true
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: "composite"
|
|
||||||
steps:
|
|
||||||
- shell: bash
|
|
||||||
run: |
|
|
||||||
helm package ${{ inputs.name }} --version ${{ inputs.tag }}
|
|
||||||
- shell: bash
|
|
||||||
run: |
|
|
||||||
curl --verbose --fail --show-error \
|
|
||||||
--user ${{ inputs.registry-user }}:${{ inputs.registry-password }} \
|
|
||||||
-X POST \
|
|
||||||
--upload-file ./${{ inputs.name }}-${{ inputs.tag }}.tgz \
|
|
||||||
https://gitea.t000-n.de/api/packages/${{ inputs.registry-user }}/helm/api/charts
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"extends": [
|
|
||||||
"local>t.behrendt/renovate-configs:common",
|
|
||||||
"local>t.behrendt/renovate-configs:action"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user