Skip to content

Commit

Permalink
perf(helm): add ci to publish helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
cjtim committed Jun 4, 2022
1 parent 0b1bdbd commit 2149820
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
tags:
- "**"

env:
REPO_NAME: be-friend
PAGES_BRANCH: gh-pages

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -41,4 +45,50 @@ jobs:
tags: |
ghcr.io/${{ github.repository }}:${{ github.sha }}
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:latest
helm-chart:
runs-on: ubuntu-latest
steps:
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
path: ${{ env.REPO_NAME }}

- name: Checkout
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ env.PAGES_BRANCH }}
path: ${{ env.PAGES_BRANCH }}

- run: tree .

- name: package charts
run: |
echo ${PWD}
cd ${{ env.REPO_NAME }}
echo "TAG: ${GITHUB_REF_NAME}"
sed -i "s/version:.*/version: ${GITHUB_REF_NAME}/" helm/Chart.yaml
sed -i "s/appVersion:.*/appVersion: \"${GITHUB_REF_NAME}\"/" helm/Chart.yaml
helm package helm --destination ../${{ env.PAGES_BRANCH }}
helm repo index ../${{ env.PAGES_BRANCH }} --url https://${{ github.repository_owner }}.github.io/${{ env.REPO_NAME }}
- name: push chart to ${{ env.PAGES_BRANCH }}
run: |
echo ${PWD}
cd ${{ env.PAGES_BRANCH }}
git config --local user.name "${{ github.repository_owner }}"
git config --local user.email "[email protected]"
git remote set-url origin https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add -A
git commit -m "Update helm chart ${GITHUB_REF_NAME}"
git push -u origin ${{ env.PAGES_BRANCH }}

0 comments on commit 2149820

Please sign in to comment.