106 lines
3.6 KiB
YAML
106 lines
3.6 KiB
YAML
name: Update Helm Dependencies
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
helmRepo:
|
|
description: 'Helm Repository'
|
|
required: true
|
|
default: 'forgejo'
|
|
type: choice
|
|
options:
|
|
- argocd
|
|
- forgejo
|
|
- ingress-nginx
|
|
tag:
|
|
description: 'Tag (e.g. v11.0.5)'
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: docker
|
|
steps:
|
|
|
|
- name: Repository meta
|
|
id: repository
|
|
run: |
|
|
registry=${{ github.server_url }}
|
|
registry=${registry##http*://}
|
|
echo "registry=${registry}" >> "$GITHUB_OUTPUT"
|
|
echo "registry=${registry}"
|
|
repository="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
|
|
echo "repository=${repository}" >> "$GITHUB_OUTPUT"
|
|
echo "repository=${repository}"
|
|
organization="$(echo "${{ github.repository }}" | sed 's|/.*||')"
|
|
echo "organization=${organization}" >> "$GITHUB_OUTPUT"
|
|
echo "organization=${organization}"
|
|
|
|
- name: Checkout helm repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ steps.repository.outputs.organization }}/${{ inputs.helmRepo }}-helm
|
|
token: ${{ secrets.PAT }}
|
|
ref: main
|
|
path: helmworkspace
|
|
fetch-depth: 0
|
|
|
|
- name: Update repo
|
|
run: |
|
|
cd helmworkspace
|
|
echo repo: ${{ inputs.helmRepo }}
|
|
echo tag: ${{ inputs.tag }}
|
|
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
|
|
if [[ "${{ inputs.helmRepo }}" == "argocd" ]]; then
|
|
git remote add upstream https://github.com/argoproj/argo-helm
|
|
elif [[ "${{ inputs.helmRepo }}" == "forgejo" ]]; then
|
|
git remote add upstream https://code.forgejo.org/forgejo-helm/forgejo-helm.git
|
|
elif [[ "${{ inputs.helmRepo }}" == "ingress-nginx" ]]; then
|
|
git remote add upstream https://github.com/kubernetes/ingress-nginx
|
|
else
|
|
echo unknown option helmRepo ${{ inputs.helmRepo }}
|
|
exit 1
|
|
fi
|
|
git fetch --all
|
|
git checkout upstream/main
|
|
git checkout main
|
|
git merge upstream/main || true
|
|
git commit || true
|
|
|
|
git push origin ${{ inputs.tag }}
|
|
|
|
git checkout ${{ inputs.tag }}
|
|
rm .gitignore
|
|
|
|
if [[ "$(uname -m)" == "x86_64" ]]; then
|
|
wget https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz
|
|
tar xf helm-v3.16.2-linux-amd64.tar.gz
|
|
mv linux-amd64/helm ../helm
|
|
rm -Rf linux-amd64 helm-v3.16.2-linux-amd64.tar.gz
|
|
else
|
|
wget https://get.helm.sh/helm-v3.16.2-linux-arm64.tar.gz
|
|
tar xf helm-v3.16.2-linux-arm64.tar.gz
|
|
mv linux-arm64/helm ../helm
|
|
rm -Rf linux-arm64 helm-v3.16.2-linux-arm64.tar.gz
|
|
fi
|
|
|
|
if [[ "${{ inputs.helmRepo }}" == "argocd" ]]; then
|
|
../helm dependency update ./charts/argo-cd
|
|
elif [[ "${{ inputs.helmRepo }}" == "forgejo" ]]; then
|
|
../helm dependency update .
|
|
../helm dependency build .
|
|
elif [[ "${{ inputs.helmRepo }}" == "ingress-nginx" ]]; then
|
|
../helm dependency update ./charts/ingress-nginx
|
|
../helm dependency build ./charts/ingress-nginx
|
|
else
|
|
echo unknown option helmRepo ${{ inputs.helmRepo }}
|
|
exit 1
|
|
fi
|
|
|
|
git add -A
|
|
git commit -m "Added helm dependencies"
|
|
git tag ${{ inputs.tag }}-depends
|
|
git push origin ${{ inputs.tag }}-depends
|