From 6f3128c201a09ad44248dc20c9d3d8867b8efa20 Mon Sep 17 00:00:00 2001 From: Andrei Stefanie Date: Mon, 5 Aug 2024 17:53:57 +0300 Subject: [PATCH] pipeline: automatically bump chart version --- .github/workflows/release.yml | 27 +++++++++++++++++++--- .releaserc.json | 43 +++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 .releaserc.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01a6cc3..a4a1819 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,13 +6,34 @@ on: - main jobs: - release: + semrel: + name: Chart Versioning runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 + persist-credentials: false + - name: Generate the next version + uses: cycjimmy/semantic-release-action@v4 + id: release + with: + dry_run: true + extra_plugins: | + @semantic-release/git + semantic-release-helm + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + release: + name: Release + runs-on: ubuntu-latest + needs: semrel + steps: + - name: Checkout + uses: actions/checkout@v4 - name: Configure Git run: | git config user.name "$GITHUB_ACTOR" @@ -22,4 +43,4 @@ jobs: - name: Run chart-releaser uses: helm/chart-releaser-action@v1.6.0 env: - CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + CR_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..a9f57ce --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,43 @@ +{ + "branches": ["main"], + "ci": true, + "debug": false, + "dryRun": false, + "tagFormat": "kubernetes-agent-${version}", + "preset": "angular", + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "angular", + "releaseRules": [ + { + "type": "build", + "release": "patch" + }, + { + "type": "style", + "release": "patch" + }, + { + "type": "test", + "release": "patch" + } + ] + } + ], + [ + "semantic-release-helm", + { + "chartPath": "./charts/kubernetes-agent" + } + ], + [ + "@semantic-release/git", + { + "message": "chore(release): <%= nextRelease.version %> on <%= new Date().toLocaleDateString('en-US', {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric' }) %> [skip ci]", + "assets": ["charts/kubernetes-agent/Chart.yaml"] + } + ] + ] +}