From 196b17dd1e65b546b814405fd43f52c54071e5cf Mon Sep 17 00:00:00 2001 From: Prashant Shahi Date: Mon, 30 Dec 2024 10:19:09 +0530 Subject: [PATCH] ci(releaser): trigger charts releaser workflow on new release (#6732) ### Summary - GH workflow to trigger releaser workflow in charts repository on new SigNoz release Signed-off-by: Prashant Shahi --- ...{releaser-signoz.yaml => prereleaser.yaml} | 4 +- .github/workflows/releaser.yaml | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) rename .github/workflows/{releaser-signoz.yaml => prereleaser.yaml} (84%) create mode 100644 .github/workflows/releaser.yaml diff --git a/.github/workflows/releaser-signoz.yaml b/.github/workflows/prereleaser.yaml similarity index 84% rename from .github/workflows/releaser-signoz.yaml rename to .github/workflows/prereleaser.yaml index 8b061b7227..c65beb3fd1 100644 --- a/.github/workflows/releaser-signoz.yaml +++ b/.github/workflows/prereleaser.yaml @@ -1,11 +1,11 @@ -name: releaser-signoz +name: prereleaser on: # schedule every wednesday 9:30 AM UTC (3pm IST) schedule: - cron: '30 9 * * 3' - # allow manual triggering of the workflow by a maintainer with no inputs + # allow manual triggering of the workflow by a maintainer workflow_dispatch: inputs: release_type: diff --git a/.github/workflows/releaser.yaml b/.github/workflows/releaser.yaml new file mode 100644 index 0000000000..5e0faefe90 --- /dev/null +++ b/.github/workflows/releaser.yaml @@ -0,0 +1,39 @@ +name: releaser + +on: + # trigger on new latest release + release: + types: [published] + +jobs: + charts: + runs-on: ubuntu-latest + steps: + - id: token + name: github-token-gen + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.PRIMUS_APP_ID }} + private-key: ${{ secrets.PRIMUS_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + - name: trigger-charts-prereleaser + run: | + # Variables + repo_owner="signoz" + repo_name="charts" + event_type="prereleaser" + + # identify the release type + release_tag=${{ github.event.release.tag_name }} + patch_number=$(echo $release_tag | awk -F. '{print $3}') + release_type="minor" + if [[ $patch_number -ne 0 ]]; then + release_type="patch" + fi + + # trigger the releaser workflow in signoz/charts repo + curl -L -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: Bearer ${{ steps.token.outputs.token }}" \ + "https://api.github.com/repos/${repo_owner}/${repo_name}/dispatches" \ + -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"release_type\": \"$release_type\"}}"