Skip to content

Commit

Permalink
fix(ci): helm chart release
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikPinsel committed Oct 20, 2023
1 parent f40a276 commit c2bd166
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,33 @@ jobs:
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
- name: Extract new app version from Chart.yaml
run: |
chart_yaml_path="./charts/managed-identity-wallet/Chart.yaml"
# Use grep to find the line containing appVersion, awk to split by ":" and cut to remove leading/trailing spaces
app_version=$(grep 'appVersion:' "$chart_yaml_path" | awk -F: '{gsub(/^[ \t]+|[ \t]+$/,"", $2); print $2}')
echo "RELEASE_VERSION=$app_version" >> $GITHUB_ENV

- name: Release chart
if: github.event_name != 'pull_request'
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
packages_with_index: true
run: |
# Package MIW chart
helm package -u -d helm-charts ./charts/managed-identity-wallet
# Commit and push to gh-pages
git add helm-charts
git stash -- helm-charts
git reset --hard
git fetch origin
git checkout gh-pages
git stash pop
# Generate helm repo index.yaml
helm repo index . --merge index.yaml --url https://${GITHUB_REPOSITORY_OWNER}.github.io/${GITHUB_REPOSITORY#*/}/
git add index.yaml
git commit -s -m "Release ${{ env.RELEASE_VERSION }}"
git push origin gh-pages
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
[
"@semantic-release/exec",
{
"prepareCmd": "sed -i 's/appVersion:.*/appVersion: ${nextRelease.version}/g' ./charts/managed-identity-wallet/Chart.yaml"
"prepareCmd": "sed -i 's/appVersion:.*/appVersion: ${nextRelease.version}/g' ./charts/managed-identity-wallet/Chart.yaml && sed -i '0,/version:.*/s//version: ${nextRelease.version}/g' ./charts/managed-identity-wallet/Chart.yaml"
}
],
[
Expand Down

0 comments on commit c2bd166

Please sign in to comment.