Skip to content

Commit

Permalink
chore(workflows): split release workflow into two for SOC 2 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
electrosenpai committed Oct 21, 2024
1 parent 7d1856e commit 759bdca
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 25 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/creating_pr.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 15 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/[email protected]
Expand All @@ -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

0 comments on commit 759bdca

Please sign in to comment.