Skip to content

Commit

Permalink
Merge pull request #809 from bcgov/feature/issue-794-chart-releaser
Browse files Browse the repository at this point in the history
Split Helm Chart Releaser into bespoke workflow with manual trigger
  • Loading branch information
esune committed Sep 14, 2023
2 parents ad2c9a4 + 8c5feee commit eb10a04
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 26 deletions.
4 changes: 4 additions & 0 deletions .github/cr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
owner: bcgov
git-repo: traction
git-base-url: https://api.github.com/
git-upload-url: https://uploads.github.com/
File renamed without changes.
48 changes: 48 additions & 0 deletions .github/workflows/chart_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Helm Chart Release

on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
# Sometimes chart-releaser might fetch an outdated index.yaml from gh-pages, causing a WAW hazard on the repo
# This job checks the remote file is up to date with the local one on release
validate-gh-pages-index:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Download remote index file and check equality
run: |
curl -vsSL https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/index.yaml > index.yaml.remote
LOCAL="$(md5sum < index.yaml)"
REMOTE="$(md5sum < index.yaml.remote)"
echo "$LOCAL" = "$REMOTE"
test "$LOCAL" = "$REMOTE"
chart-release:
name: Create chart release
runs-on: ubuntu-latest
needs: [ validate-gh-pages-index ]
steps:
- uses: actions/checkout@v3
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@v3
- name: Add bitnami repository
run: helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Release workload charts
uses: helm/chart-releaser-action@v1.5.0
with:
config: .github/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
26 changes: 0 additions & 26 deletions .github/workflows/release_assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,3 @@ jobs:
registry: ghcr.io
registry_username: ${{ github.repository_owner}}
registry_password: ${{ secrets.GITHUB_TOKEN }}

helm_release:
name: Publish Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@v3
with:
fetch-depth: 2147483647 # workaround to check-out a non-shallow repo clone

- 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@v3

- name: Add dependency chart repos
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

0 comments on commit eb10a04

Please sign in to comment.