Release Alloy CRD Helm chart #1
This file contains hidden or 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 Helm chart | |
| # yamllint disable-line rule:truthy | |
| on: | |
| workflow_dispatch: | |
| env: | |
| BIN_PATH: "${{ github.workspace }}/bin" | |
| PACKAGE_PATH: "${{ github.workspace }}/package" | |
| INDEX_PATH: "${{ github.workspace }}/index" | |
| permissions: {} | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout grafana/alloy-operator | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| path: source | |
| persist-credentials: 'false' | |
| - name: Checkout grafana/helm-charts | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| repository: grafana/helm-charts | |
| path: helm-charts | |
| persist-credentials: 'false' | |
| token: "${{ secrets.GH_BOT_ACCESS_TOKEN }}" | |
| - name: Set up Helm | |
| uses: azure/setup-helm@b9e51907a09c216f16ebe8536097933489208112 # v4.3.0 | |
| - name: Install CR tool | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| mkdir "${BIN_PATH}" | |
| mkdir "${PACKAGE_PATH}" | |
| mkdir "${INDEX_PATH}" | |
| crVersion=$(gh release list --repo helm/chart-releaser --exclude-pre-releases --json tagName --jq '.[0].tagName' | sed 's/v//') | |
| curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v${crVersion}/chart-releaser_${crVersion}_linux_amd64.tar.gz" | |
| tar -xzf cr.tar.gz -C "${BIN_PATH}" | |
| rm -f cr.tar.gz | |
| - name: Configure Git for grafana/alloy-operator | |
| working-directory: source | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "[email protected]" | |
| - name: Configure Git for grafana/helm-charts | |
| working-directory: helm-charts | |
| run: | | |
| git config user.name "$GITHUB_ACTOR" | |
| git config user.email "[email protected]" | |
| - name: Parse Chart.yaml | |
| id: parse-chart | |
| working-directory: source | |
| env: | |
| CHART_NAME: alloy-crd | |
| run: | | |
| name="$(yq ".name" "charts/${CHART_NAME}/Chart.yaml")" | |
| version="$(yq ".version" "charts/${CHART_NAME}/Chart.yaml")" | |
| { | |
| echo "description=$(yq ".description" "charts/${CHART_NAME}/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@7784200024d6b3fc01253e617ec0168daf603de3 # v1.4.7 | |
| with: | |
| input_string: ${{ steps.parse-chart.outputs.version }} | |
| - name: Create Helm package | |
| working-directory: source | |
| run: helm package charts/alloy-crd --destination "${PACKAGE_PATH}" | |
| # Note that this creates a release in grafana/helm-charts GitHub Repository with a new tag. | |
| # The tag name in grafana/helm-charts is <package>-<version>, while the | |
| # tag name for grafana/alloy-operator is <version>. | |
| - name: Create release on grafana/helm-charts | |
| uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2 | |
| with: | |
| name: ${{ steps.parse-chart.outputs.packagename }} | |
| repository: grafana/helm-charts | |
| tag_name: ${{ steps.parse-chart.outputs.packagename }} | |
| prerelease: ${{ steps.parse-version.outputs.prerelease != '' }} | |
| 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.PACKAGE_PATH }}/${{ steps.parse-chart.outputs.packagename }}.tgz | |
| fail_on_unmatched_files: true | |
| - name: Update Helm repository index | |
| working-directory: helm-charts | |
| env: | |
| CR_OWNER: grafana | |
| CR_GIT_REPO: helm-charts | |
| CR_PACKAGE_PATH: ${{ env.PACKAGE_PATH }} | |
| CR_SKIP_EXISTING: true | |
| CR_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }} | |
| run: | | |
| "${BIN_PATH}/cr" index --index-path "${INDEX_PATH}" --push |