-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #134 from cyclinder/chart_release
v0.2.1
- Loading branch information
Showing
5 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,21 +159,43 @@ jobs: | |
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896 | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.8.1 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
with: | ||
charts_dir: charts | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Chart releaser | ||
if: startsWith(github.ref, 'refs/tags/v') # we craft releases only for tags | ||
run: | | ||
# Download chart releaser | ||
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.4.1/chart-releaser_1.4.1_linux_amd64.tar.gz" | ||
tar -xzf cr.tar.gz | ||
rm -f cr.tar.gz | ||
repo=$(basename "$GITHUB_REPOSITORY") | ||
owner=$(dirname "$GITHUB_REPOSITORY") | ||
tag="${GITHUB_REF_NAME:1}" | ||
exists=$(curl -s -H "Accept: application/vnd.github.v3+json" https://github.com/$GITHUB_REPOSITORY/releases/tag/$repo-chart-$tag -w %{http_code} -o /dev/null) | ||
if [[ $exists != "200" ]]; then | ||
echo "Creating release..." | ||
# package chart | ||
./cr package charts/meta-plugins | ||
# upload chart to github releases | ||
./cr upload \ | ||
--owner "$owner" \ | ||
--git-repo "$repo" \ | ||
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \ | ||
--token "${{ secrets.GITHUB_TOKEN }}" | ||
# Update index and push to github pages | ||
./cr index \ | ||
--owner "$owner" \ | ||
--git-repo "$repo" \ | ||
--index-path index.yaml \ | ||
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \ | ||
--push | ||
else | ||
echo "Release already exists" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters