Skip to content

chore: helm chart added #2

chore: helm chart added

chore: helm chart added #2

Workflow file for this run

name: Helm Build
on:
pull_request:
types: ["opened", "synchronize"]
paths:
- 'helm-chart/**'
env:
SOURCE_BRANCH: ${{ github.event.pull_request.head.ref }}
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
jobs:
build:
if: github.event.pull_request.head.ref != 'master' && github.event_name == 'pull_request'
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
path: code
ref: ${{ env.SOURCE_BRANCH }}
fetch-depth: 2
- name: Checkout Source Target Branch
uses: actions/checkout@v4
with:
path: __target
ref: ${{ env.TARGET_BRANCH }}
fetch-depth: 2
- name: Merge Docs from target to code
run: |
rm -rf __target/docs/content
rm -rf __target/docs/images
rm -rf __target/docs/metadata
rm -rf __target/docs/artifacthub-repo.yml
rm -rf __target/docs/README.md
rm -rf __target/docs/index.html
cp -r __target/docs code
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v42
with:
path: code
files_yaml: |
plane_ce:
- helm-chart/plane-ce/**
- name: Configure Git
if: (steps.changed_files.outputs.plane_ce_any_changed == 'true')
working-directory: code
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
if: (steps.changed_files.outputs.plane_ce_any_changed == 'true')
uses: azure/setup-helm@v4
- name: Prepare GPG key #this step is for using exported keys and make your github runner
if: (steps.changed_files.outputs.plane_ce_any_changed == 'true')
working-directory: code
run: |
gpg_dir=.cr-gpg
mkdir "$gpg_dir"
keyring="$gpg_dir/secring.gpg" #referring keyring to private key of gpg
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring" #storing base64 GPG key into keyring
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file" #storing passphrase data into a file
echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV" #saving passphrase into github-environment
echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV" #saving private key into github-environemnt
env:
GPG_KEYRING_BASE64: "${{ secrets.GPG_KEYRING_BASE64 }}" #Referring secrets of github above
GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
- id: build-plane-ce
if: (steps.changed_files.outputs.plane_ce_any_changed == 'true')
name: Build Plane-CE
working-directory: code
env:
EXPORT_DIR: docs
CHART_DIR: helm-chart
CHART_REPO: plane-ce
run: |
helm package --sign --key "Plane" --keyring $CR_KEYRING --passphrase-file "$CR_PASSPHRASE_FILE" ${{ env.CHART_DIR }}/${{ env.CHART_REPO }} -u -d ${{ env.EXPORT_DIR }}/charts
helm repo index docs
- name: Publish
if: (steps.changed_files.outputs.plane_ce_any_changed == 'true')
working-directory: code
run: |
git add docs
git commit -m "Publishing Helm Charts"
git push origin ${{ github.event.pull_request.head.ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}