From 759bdca7b75849328e6909d18c340546b16dcfaa Mon Sep 17 00:00:00 2001 From: Jean-Baptiste DONNETTE Date: Mon, 21 Oct 2024 15:26:49 +0200 Subject: [PATCH 1/4] chore(workflows): split release workflow into two for SOC 2 compliance --- .github/workflows/creating_pr.yml | 43 +++++++++++++++++++++++++++++++ .github/workflows/release.yml | 40 +++++++++++----------------- 2 files changed, 58 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/creating_pr.yml diff --git a/.github/workflows/creating_pr.yml b/.github/workflows/creating_pr.yml new file mode 100644 index 0000000..37b4c98 --- /dev/null +++ b/.github/workflows/creating_pr.yml @@ -0,0 +1,43 @@ +name: Create Release PR + +on: + workflow_dispatch: + inputs: + tag: + description: 'Tag to release' + required: true + default: '1.0.0' + +jobs: + create-release-pr: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure Git + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + + - name: Update Chart and Values Versions + run: | + sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" Chart.yaml + sed -i "s/^appVersion:.*/appVersion: '${{ github.event.inputs.tag }}'/" Chart.yaml + sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" values.yaml + + - name: Commit changes + run: | + git checkout -b release/${{ github.event.inputs.tag }} + git add Chart.yaml values.yaml + git commit -m "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" + git push origin release/${{ github.event.inputs.tag }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" + branch: release/${{ github.event.inputs.tag }} + title: "Release ${{ github.event.inputs.tag }}" + body: "This PR updates the chart versions to ${{ github.event.inputs.tag }}." + labels: release \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3591665..04f0075 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,16 @@ -name: Release Charts +name: Release Charts on Merge on: - workflow_dispatch: - inputs: - tag: - description: 'Tag to release' - required: true - default: '1.0.0' + pull_request: + types: [closed] + branches: + - main jobs: - release: - permissions: - contents: write + release-on-merge: + if: > + github.event.pull_request.merged == true && + contains(github.event.pull_request.labels.*.name, 'release') runs-on: ubuntu-latest steps: - name: Checkout @@ -21,23 +20,14 @@ jobs: - name: Configure Git run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" - name: Lint Chart - Main chart - run: helm lint . + run: helm lint . - name: Update Dependencies - run: helm dependency update . - - - name: Update Chart and Values Versions - run: | - sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" Chart.yaml - sed -i "s/^appVersion:.*/appVersion: '${{ github.event.inputs.tag }}'/" Chart.yaml - sed -i "s/^version:.*/version: ${{ github.event.inputs.tag }}/" values.yaml - git add Chart.yaml values.yaml - git commit -m "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" - git push origin main + run: helm dependency update . - name: Run chart-releaser uses: helm/chart-releaser-action@v1.6.0 @@ -49,8 +39,8 @@ jobs: - name: Deploy to GitHub Pages run: | git checkout gh-pages - git pull origin main --rebase --autostash + git pull origin gh-pages helm repo index . --url https://getlago.github.io/charts git add . - git commit -m "Update Helm repo index for tag ${{ github.event.inputs.tag }}" + git commit -m "Update Helm repo index after release" git push origin gh-pages From c03a5e2c5f7b1a509c3022da92c455ed0e365838 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste DONNETTE Date: Mon, 21 Oct 2024 15:32:46 +0200 Subject: [PATCH 2/4] chore(workflows): fix pull on main not githubpage --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 04f0075..440e125 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,7 +39,7 @@ jobs: - name: Deploy to GitHub Pages run: | git checkout gh-pages - git pull origin gh-pages + git pull origin main --rebase --autostash helm repo index . --url https://getlago.github.io/charts git add . git commit -m "Update Helm repo index after release" From c2c65ccb3a17a94530c3e2a6fcfa5f0f9757f760 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste DONNETTE Date: Mon, 21 Oct 2024 15:44:40 +0200 Subject: [PATCH 3/4] chore(workflows): changing to v7 to pull request and removing default case --- .github/workflows/creating_pr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/creating_pr.yml b/.github/workflows/creating_pr.yml index 37b4c98..c817731 100644 --- a/.github/workflows/creating_pr.yml +++ b/.github/workflows/creating_pr.yml @@ -6,7 +6,6 @@ on: tag: description: 'Tag to release' required: true - default: '1.0.0' jobs: create-release-pr: @@ -34,7 +33,7 @@ jobs: git push origin release/${{ github.event.inputs.tag }} - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v7 with: commit-message: "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" branch: release/${{ github.event.inputs.tag }} From 4743ecd04b8fdf8b2214a5f7e7c44f6196cdf3c0 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste DONNETTE Date: Tue, 22 Oct 2024 15:34:16 +0200 Subject: [PATCH 4/4] chore(action) changing commit messages to be shorter one --- .github/workflows/creating_pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/creating_pr.yml b/.github/workflows/creating_pr.yml index c817731..c5cb438 100644 --- a/.github/workflows/creating_pr.yml +++ b/.github/workflows/creating_pr.yml @@ -29,13 +29,13 @@ jobs: run: | git checkout -b release/${{ github.event.inputs.tag }} git add Chart.yaml values.yaml - git commit -m "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" + git commit -m "chore(release): update to ${{ github.event.inputs.tag }}" git push origin release/${{ github.event.inputs.tag }} - name: Create Pull Request uses: peter-evans/create-pull-request@v7 with: - commit-message: "chore(release): update chart, appVersion, and values versions to ${{ github.event.inputs.tag }}" + commit-message: "chore(release): update to ${{ github.event.inputs.tag }}" branch: release/${{ github.event.inputs.tag }} title: "Release ${{ github.event.inputs.tag }}" body: "This PR updates the chart versions to ${{ github.event.inputs.tag }}."