add rebuild, releaser, and test actions
diff --git a/.github/workflows/chart-rebuild.yaml b/.github/workflows/chart-rebuild.yaml
new file mode 100644
index 0000000..9edb835
--- /dev/null
+++ b/.github/workflows/chart-rebuild.yaml
@@ -0,0 +1,57 @@
+name: Rebuild index.yaml manually
+on:
+ workflow_dispatch:
+
+jobs:
+ rebuild:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ ref: 'gh-pages'
+ fetch-depth: 0
+
+ - name: Set up Helm
+ uses: azure/setup-helm@v1
+ with:
+ version: v3.6.3
+
+ - name: Rebuild index.yaml
+ env:
+ version: v1.4.0
+ run: |
+ if [[ ! -d "$RUNNER_TOOL_CACHE" ]]; then
+ echo "Cache directory '$RUNNER_TOOL_CACHE' does not exist" >&2
+ exit 1
+ fi
+
+ arch=$(uname -m)
+ cache_dir="$RUNNER_TOOL_CACHE/ct/$version/$arch"
+
+ if [[ ! -d "$cache_dir" ]]; then
+ mkdir -p "$cache_dir"
+
+ echo "Installing chart-releaser..."
+ curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
+ tar -xzf cr.tar.gz -C "$cache_dir"
+ rm -f cr.tar.gz
+
+ echo 'Adding cr directory to PATH...'
+ export PATH="$cache_dir:$PATH"
+ fi
+
+ echo "Rebuilding index.yaml"
+ scripts/rebuild.sh
+
+ - name: Create Pull Request
+ id: cpr
+ uses: peter-evans/create-pull-request@v3
+ with:
+ commit-message: Rebuild index.yaml
+ title: Rebuild index.yaml
+
+ - name: Check outputs
+ run: |
+ echo "Created Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
+ echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
diff --git a/.github/workflows/chart-releaser.yaml b/.github/workflows/chart-releaser.yaml
new file mode 100644
index 0000000..5fcef0c
--- /dev/null
+++ b/.github/workflows/chart-releaser.yaml
@@ -0,0 +1,33 @@
+name: Release Charts
+
+on:
+ push:
+ branches:
+ - main
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Configure Git
+ run: |
+ git config user.name "$GITHUB_ACTOR"
+ git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
+
+ - name: Install Helm
+ uses: azure/setup-helm@v1
+ with:
+ version: v3.6.3
+
+ - name: Run chart-releaser
+ uses: helm/chart-releaser-action@v1.4.0
+ with:
+ charts_dir: .
+ charts_repo_url: https://apache.github.io/couchdb-helm
+ env:
+ CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
diff --git a/.github/workflows/chart-test.yaml b/.github/workflows/chart-test.yaml
new file mode 100644
index 0000000..f4f9e7d
--- /dev/null
+++ b/.github/workflows/chart-test.yaml
@@ -0,0 +1,78 @@
+name: Lint and Test Charts
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Set up Helm
+ uses: azure/setup-helm@v1
+ with:
+ version: v3.6.3
+
+ - name: Set up chart-testing
+ uses: helm/chart-testing-action@v2.1.0
+
+ - name: Run chart-testing (list-changed)
+ id: list-changed
+ run: |
+ changed=$(ct list-changed --target-branch main --chart-dirs .
+ if [[ -n "$changed" ]]; then
+ echo "::set-output name=changed::true"
+ fi
+
+ - name: Run chart-testing (lint changed)
+ run: ct lint --target-branch main --chart-dirs .
+
+ - name: Run chart-testing (lint all)
+ run: ct lint --target-branch main --all --chart-dirs .
+
+ install:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+
+ - name: Set up Helm
+ uses: azure/setup-helm@v1
+ with:
+ version: v3.6.3
+
+ - name: Set up chart-testing
+ uses: helm/chart-testing-action@v2.2.1
+
+ - name: Run chart-testing (list-changed)
+ id: list-changed
+ run: |
+ changed=$(ct list-changed --target-branch main --chart-dirs .
+ if [[ -n "$changed" ]]; then
+ echo "::set-output name=changed::true"
+ fi
+
+ - name: Create kind cluster
+ uses: helm/kind-action@v1.2.0
+ if: ( steps.list-changed.outputs.changed == 'true' ) || ${{ github.ref == 'refs/heads/main' }}
+
+ # no allow-failure until https://github.com/actions/toolkit/issues/399
+ - name: Run chart-testing (install changed)
+ if: ${{ github.ref != 'refs/heads/main' }}
+ run: ct install --target-branch main --chart-dirs .
+ continue-on-error: true
+
+ # no allow-failure until https://github.com/actions/toolkit/issues/399
+ - name: Run chart-testing (install all)
+ if: ${{ github.ref == 'refs/heads/main' }}
+ run: ct install --target-branch main --all --chart-dirs .
+ continue-on-error: true