mirror of
https://github.com/k8s-at-home/charts.git
synced 2025-01-23 15:39:02 +00:00
[workflow] update linting and release workflows (#195)
This commit is contained in:
parent
1355fc9a06
commit
a05b836cd1
6
ct.yaml → .github/ct.yaml
vendored
6
ct.yaml → .github/ct.yaml
vendored
@ -1,8 +1,10 @@
|
||||
remote: origin
|
||||
target-branch: master
|
||||
helm-extra-args: --timeout 600s
|
||||
chart-dirs:
|
||||
- charts
|
||||
excluded-charts:
|
||||
- common
|
||||
chart-repos:
|
||||
- bitnami=https://charts.bitnami.com/bitnami
|
||||
- k8s-at-home=https://k8s-at-home.com/charts
|
||||
excluded-charts:
|
||||
- common
|
47
.github/workflows/lint-test.yaml
vendored
47
.github/workflows/lint-test.yaml
vendored
@ -1,28 +1,45 @@
|
||||
name: Lint and Test Charts
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
lint-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Fetch history
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.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: |
|
||||
git fetch --prune --unshallow;
|
||||
echo "commitmsg=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_ENV
|
||||
changed=$(ct list-changed --config .github/ct.yaml)
|
||||
if [[ -n "$changed" ]]; then
|
||||
echo "::set-output name=changed::true"
|
||||
fi
|
||||
|
||||
- name: Run chart-testing (lint)
|
||||
id: lint
|
||||
uses: helm/chart-testing-action@v1.0.0
|
||||
if: "! contains(env.commitmsg, '[skip lint]')"
|
||||
with:
|
||||
command: lint
|
||||
config: ct.yaml
|
||||
run: ct lint --config .github/ct.yaml
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
|
||||
- name: Create kind cluster
|
||||
uses: helm/kind-action@v1.0.0
|
||||
if: "steps.lint.outputs.changed == 'true' && ! contains(env.commitmsg, '[skip install]')"
|
||||
uses: helm/kind-action@v1.1.0
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
|
||||
- name: Run chart-testing (install)
|
||||
uses: helm/chart-testing-action@v1.0.0
|
||||
if: "steps.lint.outputs.changed == 'true' && ! contains(env.commitmsg, '[skip install]')"
|
||||
with:
|
||||
command: install
|
||||
config: ct.yaml
|
||||
run: ct install --config .github/ct.yaml
|
||||
if: steps.list-changed.outputs.changed == 'true'
|
||||
|
59
.github/workflows/release.yaml
vendored
59
.github/workflows/release.yaml
vendored
@ -1,10 +1,11 @@
|
||||
|
||||
name: Release Charts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "charts/**"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@ -13,6 +14,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Turnstyle
|
||||
uses: softprops/turnstyle@v1
|
||||
@ -21,25 +24,47 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Fetch history
|
||||
run: git fetch --prune --unshallow
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.0
|
||||
|
||||
- name: Run chart-releaser
|
||||
uses: helm/chart-releaser-action@v1.1.0
|
||||
with:
|
||||
charts_repo_url: https://k8s-at-home.com/charts/
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
# Update the generated timestamp in the index.yaml
|
||||
# needed until https://github.com/helm/chart-releaser/issues/90
|
||||
# or helm/chart-releaser-action supports this
|
||||
post-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "gh-pages"
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
# See https://github.com/helm/chart-releaser-action/issues/6
|
||||
- name: Install Helm
|
||||
|
||||
- name: Commit and push timestamp updates
|
||||
run: |
|
||||
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
|
||||
chmod 700 get_helm.sh
|
||||
./get_helm.sh
|
||||
- name: Add dependency chart repos
|
||||
run: |
|
||||
helm repo add stable https://charts.helm.sh/stable
|
||||
- name: Run chart-releaser
|
||||
uses: helm/chart-releaser-action@v1.0.0
|
||||
with:
|
||||
charts_repo_url: https://k8s-at-home.com/charts/
|
||||
env:
|
||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
if [[ -f index.yaml ]]; then
|
||||
export generated_date=$(date --utc +%FT%T.%9NZ)
|
||||
sed -i -e "s/^generated:.*/generated: \"$generated_date\"/" index.yaml
|
||||
git add index.yaml
|
||||
git commit -sm "Update generated timestamp [ci-skip]" || exit 0
|
||||
git push
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user