wip
This commit is contained in:
82
.gitea/workflows/deploy.yaml
Normal file
82
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,82 @@
|
||||
name: Deploy on argocd repo
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
server-url:
|
||||
description: Gitea server URL
|
||||
required: true
|
||||
type: string
|
||||
argocd-repo:
|
||||
description: ArgoCD repository (owner/repo)
|
||||
required: true
|
||||
type: string
|
||||
file-path:
|
||||
description: Path to the values/manifest file to update
|
||||
required: true
|
||||
type: string
|
||||
update-helm:
|
||||
description: Whether to update the Helm chart version
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
update-image:
|
||||
description: Whether to update the image tag
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
helm-path:
|
||||
description: yq path to the Helm version field
|
||||
required: false
|
||||
type: string
|
||||
default: .spec.source.targetRevision
|
||||
helm-version:
|
||||
description: Helm chart version to set
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
image-path:
|
||||
description: yq path to the image tag field
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
image-version:
|
||||
description: Image tag to set
|
||||
required: false
|
||||
type: string
|
||||
default: ""
|
||||
secrets:
|
||||
token:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install yq
|
||||
run: |
|
||||
wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
|
||||
chmod +x /usr/local/bin/yq
|
||||
|
||||
- name: Checkout ArgoCD repo
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: ${{ inputs.argocd-repo }}
|
||||
token: ${{ secrets.token }}
|
||||
github-server-url: ${{ inputs.server-url }}
|
||||
|
||||
- name: Update Helm chart version
|
||||
if: ${{ inputs.update-helm }}
|
||||
run: yq e '${{ inputs.helm-path }} = "${{ inputs.helm-version }}"' -i "${{ inputs.file-path }}"
|
||||
|
||||
- name: Update image tag
|
||||
if: ${{ inputs.update-image }}
|
||||
run: yq e '${{ inputs.image-path }} = "${{ inputs.image-version }}"' -i "${{ inputs.file-path }}"
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.name "gitea-actions[bot]"
|
||||
git config user.email "gitea-actions[bot]@noreply.gitea"
|
||||
git add "${{ inputs.file-path }}"
|
||||
git diff --cached --quiet || git commit -m "chore: update deployment [skip ci]"
|
||||
git push
|
||||
Reference in New Issue
Block a user