Skip to content

Commit

Permalink
Fix Helm Chart release workflow (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Mar 3, 2021
1 parent 1586916 commit ffe4053
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ jobs:
env:
HELM_VERSION: v3.0.2
HELM_TMP_DIR: /tmp/helm-tmp-package
HELM_PUB_DIR: release
HELM_RELEASE_DIR: release
HELM_RELEASE_BRANCH: gh-release

steps:
- uses: actions/checkout@v2
Expand All @@ -67,35 +68,45 @@ jobs:
- uses: actions/checkout@v2
with:
ref: gh-pages
path: ./release
path: ./gh-pages
token: ${{ secrets.GITHUB_TOKEN }}

- name: Debug
run: |
ls -la .
ls -la ${HELM_PUB_DIR}
ls -la ${HELM_RELEASE_BRANCH}
ls -la ${HELM_RELEASE_BRANCH}/${HELM_RELEASE_DIR}
ls -la ${HELM_TMP_DIR}
- name: Helm Publish
run: |
cd ${HELM_RELEASE_BRANCH}
for chart in ${HELM_TMP_DIR}/*; do
chart=$(basename $chart)
echo $chart
if [ ! -f "${HELM_PUB_DIR}/${chart}" ]; then
mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_PUB_DIR}/${chart}"
if [ ! -f "${HELM_RELEASE_DIR}/${chart}" ]; then
mv -vn "${HELM_TMP_DIR}/${chart}" "${HELM_RELEASE_DIR}/${chart}"
else
echo "Chart $chart is already released!"
fi
helm repo index .
done
# Generate new index.yaml
helm repo index ${HELM_RELEASE_DIR} --url ${HELM_RELEASE_DIR}
# Move generated index.yaml to root dir
mv ${HELM_RELEASE_DIR}/index.yaml .
- name: Git Push
run: |
git add -v ${HELM_PUB_DIR}
cd ${HELM_RELEASE_BRANCH}
git add -v ${HELM_RELEASE_DIR}
git status
if ! $(git diff-index --quiet HEAD -- ${HELM_PUB_DIR}/*); then
if ! $(git diff-index --quiet HEAD -- ${HELM_RELEASE_DIR}/*); then
git add -v index.yaml
git status
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
Expand Down

0 comments on commit ffe4053

Please sign in to comment.