Giter VIP home page Giter VIP logo

library-chart-releaser-action's Introduction

library-chart-releaser-action

A GitHub Action that turns a Helm Library Chart repository into a self-hosted Helm Chart Repository using GitHub Pages.

ShellCheck test-library-chart-releaser

Differences from official chart-releaser-action

chart-releaser-action expects multiple charts, under a charts/ directory in-order to function properly out-of-the-box. In the case of my library chart, and for singular charts, it just doesn't quite fit-the-bill. To get around this issue, I simply took the chart-releaser-action and modified it a bit to support a single, stand-alone, chart library / chart.

I've also added some code in the bash script to automatically switch the origin from SSH to HTTPS before trying to run the index command for chart-releaser. Unfortunately this command is hard-coded to manipulate HTTPS endpoints, and will throw errors if you're using SSH to communicate with your repository. After it's done with the index command, it will automatically set the origin back to SSH (if needed).

Usage

Pre-requisites

  1. A GitHub repo containing a stand-alone Helm chart in the root of the repository.
  2. A GitHub branch called gh-pages to store the published charts. See charts_repo_url for alternatives.
  3. In your repo, go to Settings/Pages. Change the Source Branch to gh-pages.
  4. Create a workflow .yml file in your .github/workflows directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file

Inputs

  • version: The chart-releaser version to use (default: v1.4.1)
  • config: Optional config file for chart-releaser. For more information on the config file, see the documentation
  • charts_repo_url: The GitHub Pages URL to the charts repo (default: https://<owner>.github.io/<project>)

Environment variables

  • CR_TOKEN (required): The GitHub token of this repository (${{ secrets.GITHUB_TOKEN }})

For more information on environment variables, see the documentation.

Example Workflow

Create a workflow (eg: .github/workflows/release-library-chart.yaml):

name: Release Library Chart

on:
  push:
    branches:
      - main

jobs:
  release:
    # depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
    # see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
    permissions:
      contents: write
    runs-on: ubuntu-22.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Configure Git
        run: |
          git config user.name "$GITHUB_ACTOR"
          git config user.email "[email protected]"
          git config init.defaultBranch main

      - name: Install Helm
        uses: azure/setup-helm@v3
        with:
          version: v3.10.0

      - name: Run library-chart-releaser
        uses: justingarfield/[email protected]
        env:
          CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

This uses @justingarfield/library-chart-releaser-action to turn your GitHub repository into a self-hosted Helm chart repository.

Example using custom config

release-library-chart.yml:

- name: Run library-chart-releaser
  uses: justingarfield/[email protected]
  with:
    config: cr.yaml
    charts_repo_url: xxxxxx
  env:
    CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

cr.yaml:

owner: myaccount
git-base-url: https://api.github.com/

For options see config-file.

Credit

A huge thanks to the helm community for an awesome starting foundation and influencing the creation of this GitHub Action.

Disclaimers

I do not offer any assistance or support for others that decide to clone / fork source from this repository. I'm providing this publicly as a way to share thoughts and ideas around how folks can work with Helm, based-upon what I'm actively consuming for my own home use. I work on Linux and Windows environments exclusively, so this project will not contain files or support for macOS.

library-chart-releaser-action's People

Contributors

justingarfield avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.