Release Charts #113
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
| name: Release Charts | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'charts/**' | |
| - '.github/workflows/*' | |
| workflow_dispatch: | |
| inputs: | |
| action: | |
| description: >- | |
| Release behavior (release, delete, reupload) | |
| type: choice | |
| options: | |
| - release | |
| - delete | |
| - reupload | |
| default: release | |
| chart: | |
| description: >- | |
| Chart name (e.g. mcpo, or all) | |
| type: choice | |
| options: | |
| - all | |
| - atlassian | |
| - claude-code-api | |
| - copilot-api | |
| - gitlab | |
| - homeassistant | |
| - kubernetes | |
| - mcpo | |
| - mcp-library | |
| - playwright | |
| - search | |
| required: false | |
| version: | |
| description: >- | |
| Chart version (e.g. 0.3.2, or all) | |
| type: string | |
| required: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ----------------------------------------------------------- | |
| # Delete releases (runs for delete / reupload actions only) | |
| # ----------------------------------------------------------- | |
| manage_release: | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.event_name == 'workflow_dispatch' | |
| && (github.event.inputs.action == 'delete' | |
| || github.event.inputs.action == 'reupload') | |
| env: | |
| ACTION: ${{ github.event.inputs.action }} | |
| CHART: ${{ github.event.inputs.chart }} | |
| VERSION: ${{ github.event.inputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Validate inputs | |
| run: | | |
| if [[ -z "${CHART}" || -z "${VERSION}" ]]; then | |
| echo "::error::chart and version are required." | |
| exit 1 | |
| fi | |
| if [[ "${CHART}" == "all" \ | |
| && "${VERSION}" != "all" ]]; then | |
| echo "::error::version must be 'all' when chart is 'all'." | |
| exit 1 | |
| fi | |
| - name: Install PyYAML | |
| run: python3 -m pip install --upgrade pyyaml | |
| - name: Delete releases and gh-pages artifacts | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| bash "${GITHUB_WORKSPACE}/.github/scripts/manage_release.sh" | |
| # ----------------------------------------------------------- | |
| # Release mcp-library first (it is a dependency for others) | |
| # ----------------------------------------------------------- | |
| release_library: | |
| needs: manage_release | |
| if: >- | |
| always() | |
| && needs.manage_release.result != 'failure' | |
| && (github.event_name == 'push' | |
| || github.event.inputs.action == 'release' | |
| || (github.event.inputs.action == 'reupload' | |
| && (github.event.inputs.chart == 'all' | |
| || github.event.inputs.chart == 'mcp-library'))) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git author | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email \ | |
| "[email protected]" | |
| - name: Wipe all charts except mcp-library | |
| run: | | |
| find charts -mindepth 1 -maxdepth 1 \ | |
| ! -name 'mcp-library' -exec rm -rf {} + | |
| # ---- reupload path ---- | |
| - name: Install chart-releaser | |
| if: github.event.inputs.action == 'reupload' | |
| uses: helm/[email protected] | |
| with: | |
| install_only: true | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package library chart | |
| if: github.event.inputs.action == 'reupload' | |
| run: | | |
| bash "${{ github.workspace }}/.github/scripts/package_charts.sh" \ | |
| "charts" "mcp-library" | |
| - name: Upload and index library chart | |
| if: github.event.inputs.action == 'reupload' | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| owner="${GITHUB_REPOSITORY%%/*}" | |
| repo="${GITHUB_REPOSITORY##*/}" | |
| rm -rf .cr-index && mkdir -p .cr-index | |
| cr upload \ | |
| --owner "${owner}" \ | |
| --git-repo "${repo}" \ | |
| --commit "$(git rev-parse HEAD)" \ | |
| --skip-existing \ | |
| --pages-branch gh-pages | |
| cr index \ | |
| --owner "${owner}" \ | |
| --git-repo "${repo}" \ | |
| --push \ | |
| --pages-branch gh-pages | |
| # ---- normal release path ---- | |
| - name: Run chart-releaser | |
| if: github.event.inputs.action != 'reupload' | |
| uses: helm/[email protected] | |
| with: | |
| charts_dir: charts | |
| pages_branch: gh-pages | |
| skip_existing: true | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # ----------------------------------------------------------- | |
| # Release every other chart | |
| # ----------------------------------------------------------- | |
| release_all: | |
| needs: release_library | |
| if: >- | |
| always() | |
| && needs.release_library.result != 'failure' | |
| && (github.event_name == 'push' | |
| || github.event.inputs.action == 'release' | |
| || (github.event.inputs.action == 'reupload' | |
| && github.event.inputs.chart != 'mcp-library')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git author | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email \ | |
| "[email protected]" | |
| - name: Wipe mcp-library | |
| run: rm -rf charts/mcp-library | |
| - name: Add MCP chart repository | |
| run: | | |
| helm repo add mcp \ | |
| https://arbuzov.github.io/mcp-helm/ | |
| helm repo update | |
| # ---- reupload path ---- | |
| - name: Install chart-releaser | |
| if: github.event.inputs.action == 'reupload' | |
| uses: helm/[email protected] | |
| with: | |
| install_only: true | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Package charts | |
| if: github.event.inputs.action == 'reupload' | |
| run: | | |
| bash "${{ github.workspace }}/.github/scripts/package_charts.sh" \ | |
| "charts" "${{ github.event.inputs.chart }}" | |
| - name: Upload and index charts | |
| if: github.event.inputs.action == 'reupload' | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| owner="${GITHUB_REPOSITORY%%/*}" | |
| repo="${GITHUB_REPOSITORY##*/}" | |
| rm -rf .cr-index && mkdir -p .cr-index | |
| cr upload \ | |
| --owner "${owner}" \ | |
| --git-repo "${repo}" \ | |
| --commit "$(git rev-parse HEAD)" \ | |
| --skip-existing \ | |
| --pages-branch gh-pages | |
| cr index \ | |
| --owner "${owner}" \ | |
| --git-repo "${repo}" \ | |
| --push \ | |
| --pages-branch gh-pages | |
| # ---- normal release path ---- | |
| - name: Run chart-releaser | |
| if: github.event.inputs.action != 'reupload' | |
| uses: helm/[email protected] | |
| with: | |
| charts_dir: charts | |
| pages_branch: gh-pages | |
| skip_existing: true | |
| env: | |
| CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} |