fix: allow manually triggered image builds #1
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: Publish Helm Charts | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
chart: | ||
description: "The helm chart to publish" | ||
type: choice | ||
required: true | ||
options: ["keycloak", "metabase", "patroni", "sysdig"] | ||
default: "keycloak" | ||
jobs: | ||
build-and-push-helm: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: hmarr/debug-action@v2 | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.8.2 | ||
- name: Add Helm Dependencies | ||
if: ${{ github.event.inputs.chart }} == "keycloak" || ${{ github.event.inputs.chart }} == "metabase" | ||
run: | | ||
helm repo add patroni https://bcgov.github.io/sso-helm-charts | ||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.4.0 | ||
with: | ||
charts_dir: charts/${{ github.event.inputs.chart }} | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Remove dependencies of Keycloak Helm chart | ||
if: ${{ github.event.inputs.chart }} == "keycloak" | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq -i 'del(.dependencies) | .version = .version + "-nodep"' ./charts/keycloak/Chart.yaml | ||
- name: Remove requirements of Keycloak Helm chart | ||
if: ${{ github.event.inputs.chart }} == "keycloak" | ||
run: | | ||
rm -rf charts || true | ||
rm requirements.lock || true | ||
working-directory: ./charts/keycloak | ||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1.4.0 | ||
with: | ||
charts_dir: charts/${{ github.event.inputs.chart }} | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
CR_SKIP_EXISTING: true |