Build and Release Helm charts #170
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release Helm charts | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Version tag' | |
required: true | |
type: | |
description: 'Name of the software that should be released. ' | |
required: true | |
type: choice | |
options: | |
- stunner | |
- stunner-gateway-operator | |
env: | |
TAG: ${{ inputs.tag }} | |
TYPE: ${{ inputs.type }} | |
jobs: | |
push_chart: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Log the received tag | |
run: | | |
echo "Version is $TAG" | |
echo "Triggered by $TYPE" | |
- name: stunner-helm checkout | |
uses: actions/checkout@v4 | |
with: | |
path: stunner-helm | |
ref: main | |
repository: l7mp/stunner-helm | |
- name: l7mp.io checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.WEB_PAT_TOKEN }} | |
path: l7mp.io | |
ref: master | |
repository: l7mp/l7mp.io | |
- name: Set git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "BotL7mp" | |
- name: Edit helm chart for stunner | |
if: ${{ env.TYPE == 'stunner'}} | |
run: | | |
cd stunner-helm/helm | |
if ${{ env.TAG == 'dev' }}; then | |
sed -ri 's/^(\s*)(name\s*:\s*.*\s*$)/\1name: stunner-dev/' stunner/Chart.yaml | |
sed -ri 's/^(\s*)( pullPolicy\s*:\s*.*\s*$)/\1 pullPolicy: Always/' stunner/values.yaml | |
else | |
sed -ri 's/^(\s*)(version\s*:\s*.*\s*$)/\1version: ${{ env.TAG }}/' stunner/Chart.yaml | |
fi | |
sed -ri 's/^(\s*)(appVersion\s*:\s*.*\s*$)/\1appVersion: ${{ env.TAG }}/' stunner/Chart.yaml | |
sed -ri 's/^(\s*)( tag\s*:\s*.*\s*$)/\1 tag: ${{ env.TAG }}/' stunner/values.yaml | |
- name: Edit helm chart for stunner-gateway-operator | |
if: ${{ env.TYPE == 'stunner-gateway-operator' }} | |
run: | | |
cd stunner-helm/helm | |
if ${{ env.TAG == 'dev' }}; then | |
sed -ri 's/^(\s*)(name\s*:\s*.*\s*$)/\1name: stunner-gateway-operator-dev/' stunner-gateway-operator/Chart.yaml | |
sed -ri 's/^(\s*)( pullPolicy\s*:\s*.*\s*$)/\1 pullPolicy: Always/' stunner-gateway-operator/values.yaml | |
sed -ri 's|^(\s*)( image: l7mp/stunnerd:latest$)| image: l7mp/stunnerd:dev|' stunner-gateway-operator/values.yaml | |
sed -ri 's|^(\s*)( tag\s*:\s*.*\s*$)| tag: dev|' stunner-gateway-operator/values.yaml | |
else | |
sed -ri 's/^(\s*)(version\s*:\s*.*\s*$)/\1version: ${{ env.TAG }}/' stunner-gateway-operator/Chart.yaml | |
fi | |
sed -ri 's/^(\s*)(appVersion\s*:\s*.*\s*$)/\1appVersion: ${{ env.TAG }}/' stunner-gateway-operator/Chart.yaml | |
sed -ri 's/^(\s*)( tag\s*:\s*.*\s*$)/\1 tag: ${{ env.TAG }}/' stunner-gateway-operator/values.yaml | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.12.3 | |
- name: Set up chart-testing | |
uses: helm/chart-testing-action@v2 | |
- name: Run chart-testing (lint) | |
run: | | |
cd stunner-helm | |
ct lint --all --chart-dirs helm --excluded-charts stunner-kurento-one2one-call | |
- name: Create kind cluster | |
uses: helm/[email protected] | |
- name: Run chart-testing (install) | |
run: | | |
cd stunner-helm | |
ct install --chart-dirs helm --charts helm/${{ env.TYPE }} | |
- name: Build helm chart for ${{ env.TYPE }} | |
run: | | |
cd stunner-helm/helm | |
helm package ${{ env.TYPE }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: latest | |
check-latest: false | |
- name: Update and deploy l7mp/l7mp.io repository | |
run: | | |
if ${{ env.TAG == 'dev' }}; then | |
rm -rf l7mp.io/public/stunner/${{ env.TYPE }}-dev*.tgz | |
fi | |
cp stunner-helm/helm/*.tgz l7mp.io/public/stunner | |
helm repo index l7mp.io/public/stunner/ --url https://l7mp.io/stunner | |
cd l7mp.io | |
git add . | |
if ${{ env.TAG == 'dev' }}; then | |
git commit -m "Update dev helm chart from l7mp/${{ env.TYPE }}" -m "(triggered by the 'Helm release' github action.)" | |
else | |
git commit -m "Release helm chart from l7mp/${{ env.TYPE }}" -m "(triggered by the 'Helm release' github action.)" | |
fi | |
git push origin master | |
npm i | |
git remote set-url origin https://BotL7mp:${{ secrets.WEB_PAT_TOKEN }}@github.com/l7mp/l7mp.io.git | |
CI='' npm run deploy | |
- name: Update stunner-helm repo | |
if: ${{ env.TAG != 'dev' }} | |
run: | | |
cd stunner-helm | |
rm helm/*.tgz | |
git add . | |
git commit -m "Update helm charts from l7mp/${{ env.TYPE }}" -m "(triggered by the 'Helm release' github action.)" | |
git push origin main |