Skip to content

Commit

Permalink
Merge pull request #134 from cyclinder/chart_release
Browse files Browse the repository at this point in the history
v0.2.1
  • Loading branch information
cyclinder authored Dec 27, 2022
2 parents e5d8e46 + e973169 commit fe84c17
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 17 deletions.
44 changes: 33 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions charts/meta-plugins/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.9
version: 0.2.1

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.9"
appVersion: "0.2.1"

maintainers:
- name: Spider-Guys
Expand Down
5 changes: 3 additions & 2 deletions charts/meta-plugins/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,13 @@ Create the name of the service account to use
return the meta-plugins image
*/}}
{{- define "meta-plugins.image" -}}
{{- $repository := .Values.image.repository -}}
{{- $registry := .Values.image.registry -}}
{{- if .Values.imageRepositoryOverride }}
{{- printf "%s" .Values.imageRepositoryOverride -}}
{{- else -}}
{{- printf "%s" $repository -}}
{{- printf "%s" $registry -}}
{{- end -}}
{{- printf "/%s" .Values.image.repository }}
{{- if .Values.image.tag }}
{{- printf ":%s" .Values.image.tag -}}
{{- else -}}
Expand Down
7 changes: 6 additions & 1 deletion charts/meta-plugins/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
"type": "object",
"title": "Image Configuration",
"properties": {
"registry": {
"type": "string",
"default": "ghcr.io",
"title": "Registry"
},
"repository": {
"type": "string",
"default": "ghcr.io/spidernet-io/cni-plugins/meta-plugins",
"default": "spidernet-io/cni-plugins/meta-plugins",
"title": "Repository"
},
"tag": {
Expand Down
3 changes: 2 additions & 1 deletion charts/meta-plugins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Declare variables to be passed into your templates.

image:
repository: ghcr.io/spidernet-io/cni-plugins/meta-plugins
registry: ghcr.io
repository: spidernet-io/cni-plugins/meta-plugins
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: ""
Expand Down

0 comments on commit fe84c17

Please sign in to comment.