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 env: HELM_VERSION: 3.10.2 jobs: release-charts: name: Release charts #runs-on: ["self-hosted", "X64"] runs-on: ubuntu-latest steps: - name: Workaround run: export OPENSSL_CONF=/dev/null - name: Checkout charts branch uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} path: "src" fetch-depth: 0 - name: Checkout gh-pages branch uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_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 dep up "${SRC_DIR}/${CHART}" helm package "${SRC_DIR}/${CHART}" -u -d "${DEST_DIR}/${CHART_TYPE}" done - name: Update chart index shell: bash working-directory: dest run: | helm repo index . --url https://helm.piped.video - name: Commit changes shell: bash working-directory: dest run: | git config user.name "$GITHUB_ACTOR" git config user.email "$GITHUB_ACTOR@users.noreply.github.com" git add $(git ls-files -o --exclude-standard) git add index.yaml git commit -m "Updated from ref: $GITHUB_SHA" git push