Skip to content

Build and Bundle Jfrog Helm chart #29

Build and Bundle Jfrog Helm chart

Build and Bundle Jfrog Helm chart #29

name: Build and Bundle Jfrog Helm chart
on:
release:
types: [published]
workflow_dispatch:
inputs:
chart_version:
description: 'Build number to use for the build metadata'
required: true
default: '0.7.0'
env:
JF_PROJECT: ecosystem
JF_REPO: ecosystem-helm-dev-local
CHART_VERSION: ""
CHART_NAME: 'aerospike-vector-search'
jobs:
build-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v3
- name: Determine Version
id: get_version
run: |
if [[ -n "${{ github.event.release.tag_name }}" ]]; then
TAG_NAME=${{ github.event.release.tag_name }}
CHART_VERSION=${TAG_NAME#v}
elif [[ -n "${{ github.event.inputs.chart_version }}" ]]; then
CHART_VERSION=${{ github.event.inputs.chart_version }}
else
echo "Error: Tag name not provided and not a release event."
exit 1
fi
echo "CHART_VERSION=$CHART_VERSION" >> $GITHUB_ENV
- name: setup GPG
uses: aerospike/shared-workflows/devops/setup-gpg@main
with:
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-public-key: ${{ secrets.GPG_PUBLIC_KEY }}
gpg-key-pass: ${{ secrets.GPG_PASS }}
gpg-key-name: "aerospike-inc"
- name: setup jfrog
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: https://aerospike.jfrog.io
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
JF_PROJECT: ${{ env.JF_PROJECT }}
- name: Set Helm Chart Version
uses: mikefarah/[email protected]
with:
cmd: yq e -i '.version = "${{ env.CHART_VERSION }}"' chart/$CHART_NAME/Chart.yaml
- name: "Deploy sign and deploy helm to JFrog"
env:
GPG_TTY: no-tty
GPG_PASSPHRASE: ${{ secrets.GPG_PASS }}
run: |
cd chart
gpg --export --no-tty --passphrase "$GPG_PASSPHRASE" > ~/.gnupg/pubring.gpg
gpg --export-secret-keys --no-tty --passphrase "$GPG_PASSPHRASE">~/.gnupg/secring.gpg
echo $GPG_PASSPHRASE > passphrase.txt
helm --sign --key='aerospike-inc' --keyring='/home/runner/.gnupg/secring.gpg' --passphrase-file passphrase.txt package $CHART_NAME
jf rt u "${{env.CHART_NAME}}-${{env.CHART_VERSION}}.tgz" "${{env.JF_REPO}}/${{env.CHART_NAME}}/${{env.CHART_VERSION}}/" \
--build-name="${{env.CHART_NAME}}-helm" --build-number="${{env.CHART_VERSION}}" --project="${{env.JF_PROJECT}}"
jf rt build-collect-env "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}"
jf rt build-add-git "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}"
jf rt build-publish "${{env.CHART_NAME}}-helm" "${{env.CHART_VERSION}}" --project="${{env.JF_PROJECT}}"
- name: Create release bundle
run: |
echo '{
"name": "${{ env.CHART_NAME }}-helm",
"version": "${{ env.CHART_VERSION }}",
"files": [
{
"project": "${{ env.JF_PROJECT }}",
"build": "${{ env.CHART_NAME }}-helm/${{ env.CHART_VERSION }}"
}
]
}' > release-bundle-spec.json
cat release-bundle-spec.json
jf release-bundle-create "${{ env.CHART_NAME }}-helm" "${{ env.CHART_VERSION }}" \
--spec release-bundle-spec.json --project="${{ env.JF_PROJECT }}" --signing-key="aerospike"