mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-03 08:37:03 +02:00
Co-authored-by: JJGadgets <git@jjgadgets.tech> Co-authored-by: bjw-s-bot[bot] <87358111+bjw-s-bot[bot]@users.noreply.github.com>
96 lines
2.8 KiB
YAML
96 lines
2.8 KiB
YAML
name: "Charts: Release to GitHub pages"
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
charts:
|
|
description: >
|
|
Json encoded list of Helm charts to release.
|
|
Defaults to releasing everything.
|
|
default: "[]"
|
|
required: false
|
|
type: string
|
|
secrets:
|
|
BJWS_APP_ID:
|
|
required: true
|
|
BJWS_APP_PRIVATE_KEY:
|
|
required: true
|
|
|
|
env:
|
|
HELM_VERSION: 3.11.2
|
|
|
|
jobs:
|
|
release-charts:
|
|
name: Release charts
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Get GitHub API token
|
|
id: get-app-token
|
|
uses: getsentry/action-github-app-token@v2
|
|
with:
|
|
app_id: ${{ secrets.BJWS_APP_ID }}
|
|
private_key: ${{ secrets.BJWS_APP_PRIVATE_KEY }}
|
|
|
|
- name: Checkout charts branch
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
|
|
with:
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
path: "src"
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout gh-pages branch
|
|
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
|
|
with:
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
path: "dest"
|
|
ref: "gh-pages"
|
|
fetch-depth: 0
|
|
|
|
- name: Install Kubernetes tools
|
|
uses: yokawasa/action-setup-kube-tools@v0.9.3
|
|
with:
|
|
setup-tools: |
|
|
helmv3
|
|
helm: "${{ env.HELM_VERSION }}"
|
|
|
|
- name: Package Helm Charts
|
|
shell: bash
|
|
env:
|
|
SRC_DIR: "src/charts"
|
|
DEST_DIR: "dest"
|
|
run: |
|
|
CHARTS=( $(yq --null-input e '${{ inputs.charts }}[]' ) )
|
|
|
|
for CHART in "${CHARTS[@]}" ; do
|
|
mapfile -t CHART_PATH_PARTS < <(echo "$CHART" | tr '/' '\n')
|
|
CHART_TYPE=${CHART_PATH_PARTS[0]}
|
|
|
|
helm package "${SRC_DIR}/${CHART}" --dependency-update --destination "${DEST_DIR}/${CHART_TYPE}"
|
|
done
|
|
|
|
- name: Update chart index
|
|
shell: bash
|
|
working-directory: dest
|
|
run: |
|
|
helm repo index . --url https://bjw-s.github.io/helm-charts/
|
|
|
|
- name: Commit changes
|
|
uses: stefanzweifel/git-auto-commit-action@v5
|
|
id: auto-commit
|
|
with:
|
|
repository: dest
|
|
branch: gh-pages
|
|
commit_user_name: "bjw-s-bot[bot]"
|
|
commit_user_email: 87358111+bjw-s-bot[bot]@users.noreply.github.com
|
|
commit_author: bjw-s-bot[bot] <87358111+bjw-s-bot[bot]@users.noreply.github.com>
|
|
file_pattern: "index.yaml **/*.tgz"
|
|
disable_globbing: true
|
|
|
|
- name: Wait for deploy
|
|
uses: fountainhead/action-wait-for-check@v1.1.0
|
|
if: ${{ steps.auto-commit.outputs.changes_detected }}
|
|
id: wait-for-deploy
|
|
with:
|
|
token: ${{ steps.get-app-token.outputs.token }}
|
|
ref: ${{ steps.auto-commit.outputs.commit_hash }}
|
|
checkName: deploy
|