From 9a8409c726036d2ea6aad704b1fdafa306fa3d67 Mon Sep 17 00:00:00 2001 From: Timo Behrendt Date: Wed, 29 Apr 2026 18:17:07 +0200 Subject: [PATCH] initial --- .../action.yaml | 19 +++++ .../action.yaml | 19 +++++ .gitea/workflows/release.yaml | 26 +++++++ README.md | 69 +++++++++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 .gitea/actions/extract-chart-name-from-repo-name/action.yaml create mode 100644 .gitea/actions/extract-namespace-from-repo-name/action.yaml create mode 100644 .gitea/workflows/release.yaml create mode 100644 README.md diff --git a/.gitea/actions/extract-chart-name-from-repo-name/action.yaml b/.gitea/actions/extract-chart-name-from-repo-name/action.yaml new file mode 100644 index 0000000..7e72d80 --- /dev/null +++ b/.gitea/actions/extract-chart-name-from-repo-name/action.yaml @@ -0,0 +1,19 @@ +name: Extract chart name from repo name +description: Extracts the chart name from the repo name, based on the convention of helm- +inputs: + repo: + description: The full repository name (e.g., "helm-my-chart") + required: true +outputs: + chart-name: + description: The extracted chart name + value: ${{ steps.extract.outputs.suffix }} +runs: + using: "composite" + steps: + - id: extract + shell: bash + run: | + full_repo="${{ inputs.repo }}" + suffix="${full_repo##*helm-}" + echo "suffix=$suffix" >> $GITHUB_OUTPUT diff --git a/.gitea/actions/extract-namespace-from-repo-name/action.yaml b/.gitea/actions/extract-namespace-from-repo-name/action.yaml new file mode 100644 index 0000000..d8a639e --- /dev/null +++ b/.gitea/actions/extract-namespace-from-repo-name/action.yaml @@ -0,0 +1,19 @@ +name: "Extract namespace from repo name" +description: "Extracts the namespace name from the repo name, based on the convention of k_" +inputs: + repo: + description: 'The repo name, get it from "github.repository"' + required: true +outputs: + namespace: + description: "The namespace name" + value: ${{ steps.extract.outputs.suffix }} +runs: + using: "composite" + steps: + - id: extract + shell: bash + run: | + full_repo="${{ inputs.repo }}" + suffix="${full_repo##*k_}" + echo "suffix=$suffix" >> $GITHUB_OUTPUT diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..ea34727 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,26 @@ +name: Release + +on: + push: + branches: + - main + paths: + - ".gitea/actions/" + +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@ef0c23189db33220a73022d8c29a27709d0df440 # 0.1.32 + with: + token: ${{ secrets.GITEA_TOKEN }} + - name: Push tag + uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@47a1c635cfc76cfb4eeee3db0d0b89bf19007c7a # 0.2.3 + with: + tag: ${{ steps.tag.outputs.new-tag }} diff --git a/README.md b/README.md new file mode 100644 index 0000000..0cf84cb --- /dev/null +++ b/README.md @@ -0,0 +1,69 @@ +# k_deploy_actions + +Reusable actions for the k\_ repositories. + +## Available Actions + +### Extract Chart Name from Repository Name + +Path: `./.gitea/actions/extract-chart-name-from-repo-name` + +Extracts the chart name from repository names using the `helm-` convention. + +#### Usage + +```yaml +- name: Extract chart name + id: chart_name + uses: https://gitea.t000-n.de/t.behrendt/.gitea/actions/extract-chart-name-from-repo-name + with: + repo: ${{ github.repository_name }} # e.g. "helm-my-service" +``` + +#### Inputs + +| Parameter | Description | Required | +| --------- | ------------------------------------------- | -------- | +| `repo` | Full repository name (e.g. `helm-my-chart`) | Yes | + +#### Outputs + +| Output | Description | +| ------------ | ----------------------------------------------------------- | +| `chart-name` | Extracted chart name (e.g. `my-chart` from `helm-my-chart`) | + +#### Example + +For `helm-user-service`, this action returns `user-service`. + +### Extract Namespace from Repository Name + +Path: `./.gitea/actions/extract-namespace-from-repo-name` + +Extracts the namespace from repository names using the `k_` convention. + +#### Usage + +```yaml +- name: Extract namespace + id: namespace + uses: ./.gitea/actions/extract-namespace-from-repo-name + with: + repo: ${{ github.repository_name }} # e.g. "k_platform-service" +``` + +#### Inputs + +| Parameter | Description | Required | +| --------- | ------------------------------------------- | -------- | +| `repo` | Repository name (e.g. `k_platform-service`) | Yes | + +#### Outputs + +| Output | Description | +| ----------- | ----------------------------------------------------------------------- | +| `namespace` | Extracted namespace (e.g. `platform-service` from `k_platform-service`) | + +#### Example + +For `k_core-apps`, this action returns `core-apps`.