Skip to content

Commit

Permalink
[refactor] Adjusting package creation sync workflow
Browse files Browse the repository at this point in the history
* Specific target for sync package created
* Workflow ran on release and dispatch consuming the tag
  • Loading branch information
didierofrivia committed Jun 20, 2024
1 parent 4ba7f75 commit a2270ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/release-helm-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@

name: Release Helm Chart
on:
# TODO: The following commented lines should be used depending on the release strategy
# release:
# types:
# - released
# OR for a full release workflow
# push:
# tags:
# - 'v*.*.*'
release:
types:
- published
workflow_dispatch:
inputs:
operatorVersion:
description: Operator bundle version
default: 0.0.0
operatorTag:
description: Operator bundle version tag
default: v0.0.0
type: string

jobs:
chart_release:
runs-on: ubuntu-latest
Expand All @@ -40,19 +34,24 @@ jobs:
run: |
make helm-package
- name: Parse Tag
run: |
tag=${{ github.event.release.tag_name || inputs.operatorTag }}
echo "OPERATOR_VERSION=${tag#v}" >> $GITHUB_ENV
- name: Upload package to GitHub Release
uses: svenstaro/upload-release-action@v2
id: upload-chart
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: limitador-operator-${{ inputs.operatorVersion }}.tgz
asset_name: chart-limitador-operator-${{ inputs.operatorVersion }}.tgz
file: limitador-operator-${{ env.OPERATOR_VERSION }}.tgz
asset_name: chart-limitador-operator-${{ env.OPERATOR_VERSION }}.tgz
tag: ${{ github.ref }}
overwrite: true

- name: Sync Helm Chart with repository
run: |
make helm-sync-package \
VERSION=${{ inputs.operatorVersion }} \
make helm-sync-package-created \
VERSION=${{env.OPERATOR_VERSION}} \
HELM_WORKFLOWS_TOKEN=${{ secrets.HELM_WORKFLOWS_TOKEN }} \
BROWSER_DOWNLOAD_URL=${{ steps.upload-chart.outputs.browser_download_url }}
6 changes: 3 additions & 3 deletions make/helm.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ else
CHART_VERSION = $(VERSION)
endif

.PHONY: helm-sync-package
helm-sync-package: $(HELM) ## Sync the helm chart package to the helm-charts repo
.PHONY: helm-sync-package-created
helm-sync-package-created: $(HELM) ## Sync the helm chart package to the helm-charts repo
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $(HELM_WORKFLOWS_TOKEN)" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$(ORG)/$(HELM_REPO_NAME)/dispatches \
-d '{"event_type":"sync-chart","client_payload":{"chart":"$(REPO_NAME)","version":"$(CHART_VERSION)", "browser_download_url": "$(BROWSER_DOWNLOAD_URL)"}}'
-d '{"event_type":"chart-created","client_payload":{"chart":"$(REPO_NAME)","version":"$(CHART_VERSION)", "browser_download_url": "$(BROWSER_DOWNLOAD_URL)"}}'

0 comments on commit a2270ac

Please sign in to comment.