Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Helm Chart release workflow #113

Merged
merged 2 commits into from
Mar 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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