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

Create v2 release job #831

Merged
merged 8 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion .github/workflows/helm-release-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
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"
CR_VERSION: "1.6.1"
jobs:
setup:
runs-on: ubuntu-latest
Expand Down
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: Release Helm chart
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request: {} # Temporary while testing


#env:

Check failure on line 9 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / runner / yamllint

[yamllint] reported by reviewdog 🐶 [warning] missing starting space in comment (comments) Raw Output: ./.github/workflows/release.yml:9:2: [warning] missing starting space in comment (comments)
# CR_CONFIGFILE: "${{ github.workspace }}/source/.github/configs/cr.yaml"
# CR_INDEX_PATH: "${{ github.workspace }}/.cr-index"
# CR_TOOL_PATH: "${{ github.workspace }}/.cr-tool"
# CR_VERSION: "1.6.1"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout grafana/k8s-monitoring-helm
uses: actions/checkout@v4
with:
fetch-depth: 0
path: source

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

- name: Set up Helm
uses: azure/setup-helm@v4

- name: Configure Git
run: |
cd source
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

cd ../helm-charts
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"

# - 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: Parse Chart.yaml
id: parse-chart
working-directory: source
run: |
name="$(yq ".name" charts/k8s-monitoring/Chart.yaml)"
version="$(yq ".version" charts/k8s-monitoring/Chart.yaml)"

{
echo "description=$(yq ".description" charts/k8s-monitoring/Chart.yaml)"
echo "version=${version}"
echo "tagVersion=v${version}"
echo "packageName=${name}-${version}"
} >> "${GITHUB_OUTPUT}"

- name: Parse version
id: parse-version
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: ${{ steps.parse-chart.outputs.version }}

- name: Create Helm package
working-directory: source
run: |
helm repo add grafana https://grafana.github.io/helm-charts
helm repo add kepler https://sustainable-computing-io.github.io/kepler-helm-chart
helm repo add opencost https://opencost.github.io/opencost-helm-chart
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
mkdir ../build
helm package charts/k8s-monitoring --destination ../build

- name: Make release on K8s Monitoring Helm
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.parse-chart.outputs.tagVersion }}
repository: grafana/k8s-monitoring-helm
tag_name: ${{ steps.parse-chart.outputs.tagVersion }}
prerelease: ${{ steps.parse-version.outputs.prerelease != '' }}
token: ${{ secrets.GH_BOT_ACCESS_TOKEN }}
generate_release_notes: true
files: build/${{ steps.parse-chart.outputs.packagename }}.tgz
fail_on_unmatched_files: true

# # Note that this creates a release in grafana/helm-charts with a new tag.
# # The tag name in grafana/helm-charts is <package>-<version>, while the
# # tag name for grafana/k8s-monitoring-helm is <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
Loading