bumped manticore orchestrator image versions (#229) #43
This file contains hidden or 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
| # .github/workflows/publish-charts.yml | |
| name: Publish Helm Charts | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| migrate: | |
| description: 'Package all charts (migration mode)' | |
| type: boolean | |
| default: false | |
| template: | |
| description: 'Specific template to package e.g. nginx (leave empty for diff-based)' | |
| type: string | |
| default: '' | |
| version: | |
| description: 'Specific version to package e.g. 1.4.0 (leave empty for all versions)' | |
| type: string | |
| default: '' | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version_dirs: ${{ steps.charts.outputs.version_dirs }} | |
| charts: ${{ steps.charts.outputs.charts }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Determine charts to package | |
| id: charts | |
| run: | | |
| if [ "${{ github.event.inputs.migrate }}" = "true" ] && [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| charts=$(find . -name "Chart.yaml" -path "*/versions/*" \ | |
| | sed 's|/versions/.*||' | sed 's|^\./||' | sort -u \ | |
| | tr '\n' ' ') | |
| echo "charts=$charts" >> $GITHUB_OUTPUT | |
| elif [ -n "${{ github.event.inputs.template }}" ]; then | |
| echo "charts=${{ github.event.inputs.template }}" >> $GITHUB_OUTPUT | |
| else | |
| version_dirs=$(git diff --name-only HEAD^ HEAD \ | |
| | grep -E '^[^/]+/versions/[^/]+/' \ | |
| | sed -E 's|^([^/]+/versions/[^/]+)/.*|\1|' | sort -u \ | |
| | tr '\n' ' ') | |
| echo "version_dirs=$version_dirs" >> $GITHUB_OUTPUT | |
| fi | |
| validate: | |
| needs: [setup] | |
| if: needs.setup.outputs.version_dirs != '' || needs.setup.outputs.charts != '' | |
| uses: ./.github/workflows/validate-charts.yml | |
| with: | |
| version_dirs: ${{ needs.setup.outputs.version_dirs }} | |
| charts: ${{ needs.setup.outputs.charts }} | |
| publish: | |
| needs: [setup, validate] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Install Helm | |
| uses: azure/setup-helm@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Login to GHCR | |
| run: | | |
| echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \ | |
| --username ${{ github.actor }} \ | |
| --password-stdin | |
| - name: Determine registry | |
| id: registry | |
| run: | | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| echo "path=oci://ghcr.io/controlplane-com/templates" >> $GITHUB_OUTPUT | |
| else | |
| echo "path=oci://ghcr.io/controlplane-com/templates/test" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Package and push | |
| run: | | |
| mkdir -p .packaged | |
| package_and_push() { | |
| local version_dir="${1%/}" | |
| if [ -f "$version_dir/Chart.yaml" ]; then | |
| local template=$(echo "$version_dir" | cut -d/ -f1) | |
| local version=$(grep '^version:' "$version_dir/Chart.yaml" | awk '{print $2}') | |
| if [ -n "${{ github.event.inputs.version }}" ] && \ | |
| [ "$version" != "${{ github.event.inputs.version }}" ]; then | |
| return | |
| fi | |
| echo "Packaging $template @ $version..." | |
| helm dependency update "$version_dir" || true | |
| helm package "$version_dir" -d .packaged/ || { echo "Skipping $template @ $version - package error"; return; } | |
| helm push ".packaged/$template-$version.tgz" \ | |
| ${{ steps.registry.outputs.path }} || { echo "Skipping push $template @ $version"; return; } | |
| echo "Done: $template @ $version" | |
| fi | |
| } | |
| if [ -n "${{ needs.setup.outputs.version_dirs }}" ]; then | |
| for version_dir in ${{ needs.setup.outputs.version_dirs }}; do | |
| package_and_push "$version_dir" | |
| done | |
| else | |
| for template in ${{ needs.setup.outputs.charts }}; do | |
| for version_dir in "$template"/versions/*/; do | |
| package_and_push "$version_dir" | |
| done | |
| done | |
| fi |