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_arm64 chmod +x /usr/local/bin/yq - name: Checkout ArgoCD repo uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 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