Compare commits
39 Commits
0.0.1
...
feb33eb0dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
feb33eb0dc
|
|||
|
d03c9283b1
|
|||
|
12909ec275
|
|||
| dc62bc4e6a | |||
| d7d914ca4a | |||
| 5982457d82 | |||
| 2d3fc7613a | |||
| 269cf7adf4 | |||
| af7cbdf12b | |||
| 86b398278f | |||
| f9ac1e8589 | |||
| 7993842765 | |||
| 9c76b8bfdc | |||
| f7f5bc1b47 | |||
| d41aab78cb | |||
| 5331d22579 | |||
| c41eeb249e | |||
| c373c34c83 | |||
| 62201e92e5 | |||
| 17a08dd620 | |||
| ed39c0c50e | |||
| f0565b94fc | |||
| 00e6a2342f | |||
| a7cfa06300 | |||
| bca32c37b1 | |||
| 67ed9a6a2c | |||
| f53c854d74 | |||
| 44c0eef76e | |||
| 9f0cda99eb | |||
| 727e9408a4 | |||
| b85ff0a4d5 | |||
| 77f9944b87 | |||
| 86a968fc52 | |||
| a7f40d2070 | |||
| 1a37af7c7e | |||
| 4dc38c45d9 | |||
| 6fae395fbf | |||
| ec18df2d97 | |||
| 4eaafd04d9 |
+36
-84
@@ -3,36 +3,26 @@ name: Deploy
|
|||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
# Optional: Override the default k8s directory path
|
|
||||||
k8s_dir:
|
k8s_dir:
|
||||||
description: "Path to Kubernetes manifests directory"
|
description: "Override the default k8s directory path (k8s/)"
|
||||||
required: false
|
required: false
|
||||||
default: "k8s/"
|
default: "k8s/"
|
||||||
type: string
|
type: string
|
||||||
# Optional: Override the default helmfile path
|
|
||||||
helmfile_path:
|
helmfile_path:
|
||||||
description: "Path to helmfile.yaml"
|
description: "Override the default helmfile path (hemfile.yaml)"
|
||||||
required: false
|
required: false
|
||||||
default: "helmfile.yaml"
|
default: "helmfile.yaml"
|
||||||
type: string
|
type: string
|
||||||
# Optional: Skip Helm deployment even if helmfile exists
|
|
||||||
skip_helm_deployment:
|
skip_helm_deployment:
|
||||||
description: "Skip Helm deployment even if helmfile.yaml exists"
|
description: "Skip Helm deployment even if helmfile.yaml exists"
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
# Optional: Custom secrets to create (JSON array of secret objects)
|
skip_shared_secrets_deployment:
|
||||||
custom_secrets:
|
description: "Skip shared secrets deployment (e.g. restic backup secret)"
|
||||||
description: "JSON array of secrets to create. Each secret should have: name, type, data"
|
|
||||||
required: false
|
required: false
|
||||||
default: "[]"
|
default: false
|
||||||
type: string
|
type: boolean
|
||||||
# Optional: Branch to deploy from
|
|
||||||
deploy_branch:
|
|
||||||
description: "Branch to deploy from"
|
|
||||||
required: false
|
|
||||||
default: "main"
|
|
||||||
type: string
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect-service-type:
|
detect-service-type:
|
||||||
@@ -41,7 +31,7 @@ jobs:
|
|||||||
has_helmfile: ${{ steps.check-helmfile.outputs.exists }}
|
has_helmfile: ${{ steps.check-helmfile.outputs.exists }}
|
||||||
has_k8s: ${{ steps.check-k8s.outputs.exists }}
|
has_k8s: ${{ steps.check-k8s.outputs.exists }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Check if helmfile.yaml exists
|
- name: Check if helmfile.yaml exists
|
||||||
id: check-helmfile
|
id: check-helmfile
|
||||||
run: |
|
run: |
|
||||||
@@ -63,48 +53,43 @@ jobs:
|
|||||||
echo "No k8s directory found at ${{ inputs.k8s_dir }}"
|
echo "No k8s directory found at ${{ inputs.k8s_dir }}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
deploy-shared-secrets:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: detect-service-type
|
||||||
|
if: inputs.skip_shared_secrets_deployment != 'true'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- name: Set restic backup secret
|
||||||
|
uses: azure/k8s-create-secret@6e0ba8047235646753f2a3a3b359b4d0006ff218 # v5.0.1
|
||||||
|
with:
|
||||||
|
namespace: ${{ steps.namespace.outputs.namespace }}
|
||||||
|
secret-name: backupsidecar-secret
|
||||||
|
secret-type: generic
|
||||||
|
data: |
|
||||||
|
{
|
||||||
|
"restic_password": "${{ secrets.RESTIC_PASSWORD }}",
|
||||||
|
"restic_rest_username": "${{ secrets.RESTIC_REST_USERNAME }}",
|
||||||
|
"restic_rest_password": "${{ secrets.RESTIC_REST_PASSWORD }}",
|
||||||
|
"gotify_token": "${{ secrets.GOTIFY_TOKEN }}"
|
||||||
|
}
|
||||||
|
|
||||||
deploy-k8s:
|
deploy-k8s:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: detect-service-type
|
needs: detect-service-type
|
||||||
if: needs.detect-service-type.outputs.has_k8s == 'true'
|
if: needs.detect-service-type.outputs.has_k8s == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
|
||||||
ref: ${{ inputs.deploy_branch }}
|
|
||||||
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
||||||
id: namespace
|
id: namespace
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
- uses: azure/setup-kubectl@v4
|
- uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d # v5.1.0
|
||||||
- uses: azure/k8s-set-context@v4
|
- uses: azure/k8s-set-context@89b837d75b40a7bd2ddafde837473c212db8b313 # v5.0.0
|
||||||
with:
|
with:
|
||||||
method: kubeconfig
|
method: kubeconfig
|
||||||
kubeconfig: ${{ secrets.KUBECONFIG }}
|
kubeconfig: ${{ secrets.KUBECONFIG }}
|
||||||
- name: Create custom secrets
|
|
||||||
id: create-secrets
|
|
||||||
run: |
|
|
||||||
# Parse custom secrets from input
|
|
||||||
SECRETS='${{ inputs.custom_secrets }}'
|
|
||||||
if [ "$SECRETS" != "[]" ]; then
|
|
||||||
echo "Creating custom secrets..."
|
|
||||||
echo "$SECRETS" | jq -c '.[]' | while read -r secret; do
|
|
||||||
SECRET_NAME=$(echo "$secret" | jq -r '.name')
|
|
||||||
SECRET_TYPE=$(echo "$secret" | jq -r '.type // "generic"')
|
|
||||||
SECRET_DATA=$(echo "$secret" | jq -r '.data')
|
|
||||||
|
|
||||||
echo "Creating secret: $SECRET_NAME (type: $SECRET_TYPE)"
|
|
||||||
|
|
||||||
# Create the secret using kubectl
|
|
||||||
echo "$SECRET_DATA" | kubectl create secret $SECRET_TYPE $SECRET_NAME \
|
|
||||||
--from-literal=secret.json="$SECRET_DATA" \
|
|
||||||
--namespace=${{ steps.namespace.outputs.namespace }} \
|
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "No custom secrets to create"
|
|
||||||
fi
|
|
||||||
- name: Deploy Kubernetes manifests
|
- name: Deploy Kubernetes manifests
|
||||||
uses: azure/k8s-deploy@v5.0.4
|
uses: azure/k8s-deploy@c7ebd0d5f39477a23f1b5dea0f52e6db04adf28e # v6.0.0
|
||||||
with:
|
with:
|
||||||
action: deploy
|
action: deploy
|
||||||
manifests: "${{ inputs.k8s_dir }}"
|
manifests: "${{ inputs.k8s_dir }}"
|
||||||
@@ -119,44 +104,19 @@ jobs:
|
|||||||
needs.detect-service-type.outputs.has_k8s == 'true' &&
|
needs.detect-service-type.outputs.has_k8s == 'true' &&
|
||||||
inputs.skip_helm_deployment != 'true'
|
inputs.skip_helm_deployment != 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
|
||||||
ref: ${{ inputs.deploy_branch }}
|
|
||||||
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
||||||
id: namespace
|
id: namespace
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
- uses: azure/setup-kubectl@v4
|
- uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d # v5.1.0
|
||||||
- uses: azure/setup-helm@v4
|
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
|
||||||
- uses: azure/k8s-set-context@v4
|
- uses: azure/k8s-set-context@89b837d75b40a7bd2ddafde837473c212db8b313 # v5.0.0
|
||||||
with:
|
with:
|
||||||
method: kubeconfig
|
method: kubeconfig
|
||||||
kubeconfig: ${{ secrets.KUBECONFIG }}
|
kubeconfig: ${{ secrets.KUBECONFIG }}
|
||||||
- name: Create custom secrets
|
|
||||||
id: create-secrets
|
|
||||||
run: |
|
|
||||||
# Parse custom secrets from input
|
|
||||||
SECRETS='${{ inputs.custom_secrets }}'
|
|
||||||
if [ "$SECRETS" != "[]" ]; then
|
|
||||||
echo "Creating custom secrets..."
|
|
||||||
echo "$SECRETS" | jq -c '.[]' | while read -r secret; do
|
|
||||||
SECRET_NAME=$(echo "$secret" | jq -r '.name')
|
|
||||||
SECRET_TYPE=$(echo "$secret" | jq -r '.type // "generic"')
|
|
||||||
SECRET_DATA=$(echo "$secret" | jq -r '.data')
|
|
||||||
|
|
||||||
echo "Creating secret: $SECRET_NAME (type: $SECRET_TYPE)"
|
|
||||||
|
|
||||||
# Create the secret using kubectl
|
|
||||||
echo "$SECRET_DATA" | kubectl create secret $SECRET_TYPE $SECRET_NAME \
|
|
||||||
--from-literal=secret.json="$SECRET_DATA" \
|
|
||||||
--namespace=${{ steps.namespace.outputs.namespace }} \
|
|
||||||
--dry-run=client -o yaml | kubectl apply -f -
|
|
||||||
done
|
|
||||||
else
|
|
||||||
echo "No custom secrets to create"
|
|
||||||
fi
|
|
||||||
- name: Deploy Helm
|
- name: Deploy Helm
|
||||||
uses: helmfile/helmfile-action@v2
|
uses: helmfile/helmfile-action@02671705b1dda1dc4b0a4ddd4f9f1ea8f4568c6f # v2.4.3
|
||||||
with:
|
with:
|
||||||
helmfile-args: apply
|
helmfile-args: apply
|
||||||
|
|
||||||
@@ -187,11 +147,3 @@ jobs:
|
|||||||
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Service Type**: ${{ needs.detect-service-type.outputs.has_helmfile == 'true' && 'Helm + Kubernetes' || 'Kubernetes Only' }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
# Show custom secrets info
|
|
||||||
SECRETS='${{ inputs.custom_secrets }}'
|
|
||||||
if [ "$SECRETS" != "[]" ]; then
|
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "**Custom Secrets Created**: $(echo "$SECRETS" | jq length)" >> $GITHUB_STEP_SUMMARY
|
|
||||||
echo "$SECRETS" | jq -r '.[] | "- " + .name + " (" + (.type // "generic") + ")"' >> $GITHUB_STEP_SUMMARY
|
|
||||||
fi
|
|
||||||
|
|||||||
+11
-11
@@ -26,7 +26,7 @@ jobs:
|
|||||||
has_helmfile: ${{ steps.check-helmfile.outputs.exists }}
|
has_helmfile: ${{ steps.check-helmfile.outputs.exists }}
|
||||||
has_k8s: ${{ steps.check-k8s.outputs.exists }}
|
has_k8s: ${{ steps.check-k8s.outputs.exists }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- name: Check if helmfile.yaml exists
|
- name: Check if helmfile.yaml exists
|
||||||
id: check-helmfile
|
id: check-helmfile
|
||||||
run: |
|
run: |
|
||||||
@@ -53,18 +53,18 @@ jobs:
|
|||||||
needs: detect-service-type
|
needs: detect-service-type
|
||||||
if: needs.detect-service-type.outputs.has_k8s == 'true'
|
if: needs.detect-service-type.outputs.has_k8s == 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
||||||
id: namespace
|
id: namespace
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
- uses: azure/setup-kubectl@v4
|
- uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d # v5.1.0
|
||||||
- uses: azure/k8s-set-context@v4
|
- uses: azure/k8s-set-context@89b837d75b40a7bd2ddafde837473c212db8b313 # v5.0.0
|
||||||
with:
|
with:
|
||||||
method: kubeconfig
|
method: kubeconfig
|
||||||
kubeconfig: ${{ secrets.KUBECONFIG }}
|
kubeconfig: ${{ secrets.KUBECONFIG }}
|
||||||
- name: Validate k8s manifests
|
- name: Validate k8s manifests
|
||||||
uses: azure/k8s-lint@v3
|
uses: azure/k8s-lint@6aefe5066f95e73d2b140d8835cc95583b886989 # v3.0.1
|
||||||
with:
|
with:
|
||||||
namespace: ${{ steps.namespace.outputs.namespace }}
|
namespace: ${{ steps.namespace.outputs.namespace }}
|
||||||
lintType: dryrun
|
lintType: dryrun
|
||||||
@@ -78,26 +78,26 @@ jobs:
|
|||||||
needs.detect-service-type.outputs.has_k8s == 'true' &&
|
needs.detect-service-type.outputs.has_k8s == 'true' &&
|
||||||
inputs.skip_helm_validation != 'true'
|
inputs.skip_helm_validation != 'true'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
- uses: ./.gitea/actions/extract-namespace-from-repo-name
|
||||||
id: namespace
|
id: namespace
|
||||||
with:
|
with:
|
||||||
repo: ${{ github.repository }}
|
repo: ${{ github.repository }}
|
||||||
- uses: azure/setup-kubectl@v4
|
- uses: azure/setup-kubectl@829323503d1be3d00ca8346e5391ca0b07a9ab0d # v5.1.0
|
||||||
- uses: azure/setup-helm@v4
|
- uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5
|
||||||
- uses: azure/k8s-set-context@v4
|
- uses: azure/k8s-set-context@89b837d75b40a7bd2ddafde837473c212db8b313 # v5.0.0
|
||||||
with:
|
with:
|
||||||
method: kubeconfig
|
method: kubeconfig
|
||||||
kubeconfig: ${{ secrets.KUBECONFIG }}
|
kubeconfig: ${{ secrets.KUBECONFIG }}
|
||||||
- name: Validate Helm
|
- name: Validate Helm
|
||||||
uses: helmfile/helmfile-action@v2.1.0
|
uses: helmfile/helmfile-action@02671705b1dda1dc4b0a4ddd4f9f1ea8f4568c6f # v2.4.3
|
||||||
with:
|
with:
|
||||||
helmfile-args: diff
|
helmfile-args: diff
|
||||||
|
|
||||||
# Summary job that always runs to show what was validated
|
# Summary job that always runs to show what was validated
|
||||||
ci-summary:
|
ci-summary:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [detect-service-type, validate-k8s, validate-helm]
|
needs: [ detect-service-type, validate-k8s, validate-helm ]
|
||||||
if: always()
|
if: always()
|
||||||
steps:
|
steps:
|
||||||
- name: CI Summary
|
- name: CI Summary
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ jobs:
|
|||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Increment tag
|
- name: Increment tag
|
||||||
id: tag
|
id: tag
|
||||||
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@0.1.15
|
uses: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment@ef0c23189db33220a73022d8c29a27709d0df440 # 0.1.32
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITEA_TOKEN }}
|
token: ${{ secrets.GITEA_TOKEN }}
|
||||||
- name: Push tag
|
- name: Push tag
|
||||||
uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@0.0.3
|
uses: https://gitea.t000-n.de/t.behrendt/actions/release-git-tag@47a1c635cfc76cfb4eeee3db0d0b89bf19007c7a # 0.2.3
|
||||||
with:
|
with:
|
||||||
tag: ${{ steps.tag.outputs.new-tag }}
|
tag: ${{ steps.tag.outputs.new-tag }}
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": ["local>t.behrendt/renovate-configs:action"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user