generate new index.yaml and push to git #37
Workflow file for this run
This file contains 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: Helm package and push to Github Pages | |
on: | |
# publish on releases, e.g. v2.1.13 (image tagged as "2.1.13" - "v" prefix is removed) | |
# release: | |
# types: [ published ] | |
push: | |
tags: | |
- "v*.*.*" | |
# branches: | |
# - 'main' | |
# paths: | |
# - 'helm-chart/**' | |
# - '.github/workflows/helm-package-and-publish.yaml' | |
# TODO: | |
# - package helm | |
# - upload release artifact | |
# - get its url | |
# - update/merge gh-pages/index.yaml | |
jobs: | |
helm-package-and-push-to-ghcr-io: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Helm | |
uses: azure/[email protected] | |
- name: Helm Package and Push to ghcr.io | |
id: helm_package | |
run: | | |
echo "Tag version: $GITHUB_REF" | |
RELEASE_TAG="${GITHUB_REF#refs/tags/}" | |
VERSION="${RELEASE_TAG:-v666.666.666}" | |
echo "VERSION Version: $VERSION" | |
CLEAN_VERSION="${VERSION#v}" | |
echo "CLEAN_VERSION Version: $CLEAN_VERSION" | |
PACKAGE_OUTPUT=$(helm package --version "$CLEAN_VERSION" helm-chart) | |
echo "PACKAGE_OUTPUT=$PACKAGE_OUTPUT" | |
PACKAGE_NAME=$(basename "$PACKAGE_OUTPUT") | |
echo "Generated helm package: $PACKAGE_NAME" | |
# save the generated package name to github_output to pass it to next step | |
echo "package-name=$PACKAGE_NAME" >> $GITHUB_OUTPUT | |
echo "package-version=$CLEAN_VERSION" >> $GITHUB_OUTPUT | |
- name: Print helm_package step output | |
run: | | |
echo "package-name=$MESSAGE" | |
env: | |
MESSAGE: ${{ steps.helm_package.outputs.package-name}} | |
- name: Release | |
id: create_release_and_upload_artifacts | |
uses: softprops/[email protected] | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ${{ steps.helm_package.outputs.package-name}} | |
token: ${{ secrets.GHCR_TOKEN }} | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
# TODO: update release body | |
body: | | |
<https://oguzhan-yilmaz.github.io/steampipe-powerpipe-kubernetes/> | |
```bash | |
helm repo add oguzhan-yilmaz https://oguzhan-yilmaz.github.io/steampipe-powerpipe-kubernetes | |
helm repo add oguzhan-yilmaz https://oguzhan-yilmaz.github.io/steampipe-powerpipe-kubernetes --version ${{ steps.helm_package.outputs.package-version}} | |
``` | |
- name: 'Setup jq' | |
uses: dcarbone/install-jq-action@v2 | |
- name: print release upload output | |
run: | | |
echo "assets=${{ steps.create_release_and_upload_artifacts.outputs.assets}}" | |
- name: Save artifact download url | |
id: helm_package_download_url | |
run: | | |
DOWNLOAD_URL=$(echo '${{ steps.create_release_and_upload_artifacts.outputs.assets}}' | jq '.[0].browser_download_url') | |
echo "DOWNLOAD_URL=$DOWNLOAD_URL" | |
echo "download_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT | |
- name: Print helm_package download url | |
run: | | |
echo 'package-name=${{ steps.helm_package_download_url.outputs.download_url}}' | |
- name: Clone gh-pages branch | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
run: | | |
git clone -b gh-pages https://github.com/oguzhan-yilmaz/steampipe-powerpipe-kubernetes.git gh-pages-clone | |
ls -al | |
ls -al gh-pages-clone | |
helm repo index . --url https://oguzhan-yilmaz.github.io/steampipe-powerpipe-kubernetes/ --merge gh-pages-clone/index.yaml | |
ls -al | |
rm gh-pages-clone/index.yaml | |
cp index.yaml gh-pages-clone/index.yaml | |
cd gh-pages-clone | |
pwd | |
cat index.yaml | |
git push origin/gh-pages | |