generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from cybozu-go/add-helm-ci
add helm-related CI
- Loading branch information
Showing
2 changed files
with
125 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Release Charts | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'chart-v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.6.3 | ||
|
||
- name: Check chart version | ||
run: | | ||
tag_version=${GITHUB_REF##*/chart-v} | ||
chart_version=$(cat charts/tenet/Chart.yaml | grep 'version:' | sed 's/version:\s//') | ||
if [ "$tag_version" != "$chart_version" ]; then | ||
echo "Different versions: tag \"$tag_version\", chart \"$chart_version\"" | ||
exit 1 | ||
fi | ||
- name: Packaging the chart | ||
run: helm package ./charts/tenet/ | ||
|
||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: helm-charts | ||
path: ./tenet-*.tgz | ||
retention-days: 1 | ||
|
||
publish: | ||
name: Publish charts on GitHub Pages | ||
runs-on: ubuntu-20.04 | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
|
||
- name: Set up Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.6.3 | ||
|
||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: helm-charts | ||
|
||
- name: Update charts index | ||
run: helm repo index --url https://cybozu-go.github.io/tenet/ --merge index.yaml . | ||
|
||
- run: git add . | ||
|
||
- name: Check diffs | ||
run: | | ||
diffs=$(git status -s) | ||
if [ "$diffs" = "" ]; then | ||
echo "NO_DIFF=1" >> $GITHUB_ENV | ||
else | ||
printf "%s\n" "$diffs" | ||
fi | ||
- name: Commit changes | ||
if: env.NO_DIFF != '1' | ||
run: | | ||
git config --global user.name 'Cybozu Neco' | ||
git config --global user.email 'cybozu-neco@users.noreply.github.com' | ||
git commit -m 'update' | ||
- name: Push to gh-pages | ||
if: env.NO_DIFF != '1' | ||
run: git push origin gh-pages |
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Lint and Test Charts | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "charts/**" | ||
- '!**.md' | ||
|
||
jobs: | ||
lint-test: | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7 | ||
|
||
- name: Set up chart-testing | ||
uses: helm/chart-testing-action@v2.0.1 | ||
|
||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
run: | | ||
changed=$(ct list-changed --config ct.yaml) | ||
if [[ -n "$changed" ]]; then | ||
echo "::set-output name=changed::true" | ||
fi | ||
- name: Run chart-testing (lint) | ||
run: ct lint --config ct.yaml | ||
|
||
- name: Create kind cluster | ||
uses: helm/kind-action@v1.2.0 | ||
if: steps.list-changed.outputs.changed == 'true' | ||
with: | ||
node_image: kindest/node:v1.22.4 | ||
|
||
- name: Apply cert-manager | ||
run: | | ||
kubectl apply -f https://github.com/jetstack/cert-manager/releases/latest/download/cert-manager.yaml | ||
kubectl -n cert-manager wait --for=condition=available --timeout=180s --all deployments | ||
- name: Run chart-testing (install) | ||
run: ct install --config ct.yaml |