feat: several fixes for Mailu 2024.06 support #142
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Helm lint and test chart | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: | |
- master | |
paths: | |
- mailu/** | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
lint-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.10.0 | |
- name: Install dependencies | |
run: | | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo update | |
helm dependency build mailu | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
check-latest: true | |
# - name: Run helm lint | |
# run: helm lint --strict --values mailu/helm-lint-values.yaml mailu | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
- name: Run chart-testing (list-changed) | |
id: list-changed | |
run: | | |
changed=$(ct list-changed --config ct.yaml --target-branch ${{ github.event.repository.default_branch }}) | |
if [[ -n "$changed" ]]; then | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Run chart-testing (lint) | |
run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} --check-version-increment=false | |
- name: Create kind cluster | |
if: steps.list-changed.outputs.changed == 'true' | |
uses: helm/[email protected] | |
with: | |
config: kind-cluster.yaml | |
- name: Install Calico | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
kubectl create -f https://raw.githubusercontent.com/projectcalico/calico/v3.24.5/manifests/calico.yaml | |
kubectl -n kube-system rollout status daemonset/calico-node --timeout=120s | |
kubectl -n kube-system rollout status deployment calico-kube-controllers --timeout=120s | |
- name: Fix CoreDNS upstream resolver | |
if: steps.list-changed.outputs.changed == 'true' | |
run: | | |
kubectl -n kube-system get configmaps coredns -o yaml | sed 's/forward . \/etc\/resolv.conf/forward . 8.8.8.8:53/g' | kubectl apply -f - | |
kubectl -n kube-system rollout restart deployment coredns | |
kubectl -n kube-system rollout status deployment coredns --timeout=120s | |
- name: Run chart-testing (install) | |
id: install | |
if: steps.list-changed.outputs.changed == 'true' | |
run: ct install --debug --config ct.yaml | |
update-readme-metadata: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: lint-and-test | |
steps: | |
- name: Install readme-generator-for-helm | |
run: npm install -g @bitnami/readme-generator-for-helm | |
- name: Checkout mailu/helm-charts | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.ref}} | |
repository: ${{github.event.pull_request.head.repo.full_name}} | |
path: charts | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Execute readme-generator-for-helm | |
run: | | |
echo "Updating README.md for mailu chart" | |
readme-generator --values "charts/mailu/values.yaml" --readme "charts/mailu/README.md" --schema "/tmp/schema.json" | |
- name: Push changes | |
run: | | |
# Push all the changes | |
cd charts | |
git config --global user.email "[email protected]" | |
git config --global user.name "Github actions" | |
git add -A | |
if ! git diff-index --quiet HEAD; then | |
git commit -am "Update README.md with readme-generator-for-helm" --signoff | |
git push | |
fi |