Skip to content

Commit 2db0fc4

Browse files
authored
Fix issue in release workflow (#236)
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
1 parent 8227a21 commit 2db0fc4

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,33 @@ jobs:
5555
- name: Install Helm
5656
uses: azure/setup-helm@v3
5757
- name: Run chart-releaser
58-
uses: helm/[email protected]
59-
env:
60-
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
58+
run: |
59+
# From: https://github.com/metallb/metallb/blob/293f43c1f78ab1b5fa8879a76746b094bd9dd3ca/.github/workflows/publish.yaml#L134-L163
60+
# Ref: https://github.com/helm/chart-releaser-action/issues/60
61+
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.5.0/chart-releaser_1.5.0_linux_amd64.tar.gz"
62+
tar -xzf cr.tar.gz
63+
rm -f cr.tar.gz
64+
repo=$(basename "$GITHUB_REPOSITORY")
65+
owner=$(dirname "$GITHUB_REPOSITORY")
66+
tag="${GITHUB_REF_NAME:1}"
67+
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)
68+
if [[ $exists != "200" ]]; then
69+
echo "Creating release..."
70+
# package chart
71+
./cr package charts/$repo
72+
# upload chart to github releases
73+
./cr upload \
74+
--owner "$owner" \
75+
--git-repo "$repo" \
76+
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \
77+
--token "${{ secrets.GITHUB_TOKEN }}"
78+
# Update index and push to github pages
79+
./cr index \
80+
--owner "$owner" \
81+
--git-repo "$repo" \
82+
--index-path index.yaml \
83+
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \
84+
--push
85+
else
86+
echo "Release already exists"
87+
fi

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "gitvote"
33
description = "GitVote server"
4-
version = "0.1.0"
4+
version = "0.2.0"
55
license = "Apache-2.0"
66
edition = "2021"
77

0 commit comments

Comments
 (0)