Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release-beyla-helm-chart job #802

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 11 additions & 104 deletions .github/workflows/helm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,108 +2,15 @@ name: Release Helm chart
on:
workflow_dispatch:

env:
CR_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/cr.yml"
CT_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/ct.yml"
CR_INDEX_PATH: "${{ github.workspace }}/.cr-index"
CR_PACKAGE_PATH: "${{ github.workspace }}/.cr-release-packages"
CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
CR_VERSION: "1.5.0"
CHART_DIR: "${{ github.workspace }}/source/charts/beyla"

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

release:
needs: [setup]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

- name: Configure Git
run: |
cd source
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Checkout helm-charts
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: grafana/helm-charts
path: helm-charts
token: "${{ secrets.GITHUB_TOKEN }}"

- name: Configure Git for helm-charts
run: |
cd helm-charts
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Set up Helm
uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Parse Chart.yaml
id: parse-chart
run: |
cd source
charpath="${{ env.CHART_DIR }}"
description=$(yq ".description" < ${{ env.CHART_DIR }}/Chart.yaml)
name=$(yq ".name" < ${{ env.CHART_DIR }}/Chart.yaml)
version=$(yq ".version" < ${{ env.CHART_DIR }}/Chart.yaml)

echo "chartpath=${charpath}" >> $GITHUB_OUTPUT
echo "desc=${description}" >> $GITHUB_OUTPUT
echo "tagname=v${version}" >> $GITHUB_OUTPUT
echo "packagename=${name}-${version}" >> $GITHUB_OUTPUT

- name: Install CR tool
run: |
mkdir "${CR_TOOL_PATH}"
mkdir "${CR_PACKAGE_PATH}"
mkdir "${CR_INDEX_PATH}"
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${CR_VERSION}/chart-releaser_${CR_VERSION}_linux_amd64.tar.gz"
tar -xzf cr.tar.gz -C "${CR_TOOL_PATH}"
rm -f cr.tar.gz

- name: Create Helm package
run: |
cd source
helm repo add grafana https://grafana.github.io/helm-charts
"${CR_TOOL_PATH}/cr" package "${{ steps.parse-chart.outputs.chartpath }}" --config "${CR_CONFIGFILE}" --package-path "${CR_PACKAGE_PATH}"

# Note that this creates a release in grafana/helm-charts with a new tag.
# The tag name in grafana/helm-charts is <package>-<version>
- name: Make release on Helm Charts
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.parse-chart.outputs.packagename }}
repository: grafana/helm-charts
tag_name: ${{ steps.parse-chart.outputs.packagename }}
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
body: |
${{ steps.parse-chart.outputs.desc }}

Source commit: https://github.com/${{ github.repository }}/commit/${{ github.sha }}

Tag on source: https://github.com/${{ github.repository }}/releases/tag/${{ steps.parse-chart.outputs.tagname }}
files: |
${{ env.CR_PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz

- name: Update helm-charts index.yaml
run: |
cd helm-charts
"${CR_TOOL_PATH}/cr" index --config "${CR_CONFIGFILE}" --token "${{ secrets.GH_BOT_ACCESS_TOKEN }}" --index-path "${CR_INDEX_PATH}" --package-path "${CR_PACKAGE_PATH}" --push
release-beyla-helm-chart:
uses: grafana/helm-charts/.github/workflows/update-helm-repo.yaml@main
with:
charts_dir: charts/beyla
cr_configfile: .github/configs/cr.yml
ct_configfile: .github/configs/ct.yml
secrets:
# values are created in https://github.com/organizations/grafana/settings/apps/grafana-beyla-release
# and copied to a repository secret
github_app_id: ${{ secrets.BEYLA_RELEASE_APP_ID }}
github_app_pem: ${{ secrets.BEYLA_RELEASE_APP_PEM }}
Loading