Release Private Chart to Public Repo #2
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: Release Private Chart to Public Repo | |
on: | |
workflow_dispatch: | |
inputs: | |
name: | |
description: name of the chart (e.g. `levoai/levoai-ebpf-sensor`) | |
required: true | |
type: string | |
version: | |
description: version of the chart (e.g. `0.1.0`) | |
required: false | |
type: string | |
workflow_call: | |
inputs: | |
name: | |
required: true | |
type: string | |
version: | |
required: false | |
type: string | |
concurrency: charts | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.LEVOBOT_TOKEN }} | |
- name: Configure Git | |
run: | | |
gh auth setup-git | |
git config user.name "levobot" | |
git config user.email "[email protected]" | |
env: | |
GH_TOKEN: ${{ secrets.LEVOBOT_TOKEN }} | |
- uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: ${{ secrets.GCS_SA_KEY }} | |
- uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.4.0 | |
- name: Download Private Chart | |
run: | | |
helm plugin install https://github.com/hayorov/helm-gcs.git --version 0.4.1 || echo "Helm plugin already exists." | |
helm repo add levoai-private ${{ secrets.HELM_GCS_REPOSITORY }} || echo "Helm repo already exists" | |
helm repo update | |
mkdir -p .cr-release-packages | |
cd .cr-release-packages | |
helm pull levoai-private/${{ inputs.name }} --version "${{ inputs.version }}" | |
- name: Release Chart | |
uses: helm/[email protected] | |
with: | |
skip_packaging: true | |
skip_existing: true | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: Extract Chart to Repo | |
run: | | |
# We're doing this for easy auditability | |
rm -rf levoai/${{ inputs.name }} | |
tar xzf .cr-release-packages/*.tgz -C levoai/ | |
git add levoai/${{ inputs.name }} | |
git commit -sm "Update ${{ inputs.name }} to latest released version" | |
git push --force-with-lease origin main |