[workflow] update linting and release workflows (#195)

This commit is contained in:
ᗪєνιη ᗷυнʟ 2020-11-24 08:30:11 -05:00 committed by GitHub
parent 1355fc9a06
commit a05b836cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 34 deletions

View File

@ -1,8 +1,10 @@
remote: origin
target-branch: master
helm-extra-args: --timeout 600s helm-extra-args: --timeout 600s
chart-dirs: chart-dirs:
- charts - charts
excluded-charts:
- common
chart-repos: chart-repos:
- bitnami=https://charts.bitnami.com/bitnami - bitnami=https://charts.bitnami.com/bitnami
- k8s-at-home=https://k8s-at-home.com/charts - k8s-at-home=https://k8s-at-home.com/charts
excluded-charts:
- common

View File

@ -1,28 +1,45 @@
name: Lint and Test Charts name: Lint and Test Charts
on: pull_request on: pull_request
jobs: jobs:
lint-test: lint-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 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: | run: |
git fetch --prune --unshallow; changed=$(ct list-changed --config .github/ct.yaml)
echo "commitmsg=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_ENV if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint) - name: Run chart-testing (lint)
id: lint id: lint
uses: helm/chart-testing-action@v1.0.0 run: ct lint --config .github/ct.yaml
if: "! contains(env.commitmsg, '[skip lint]')" if: steps.list-changed.outputs.changed == 'true'
with:
command: lint
config: ct.yaml
- name: Create kind cluster - name: Create kind cluster
uses: helm/kind-action@v1.0.0 uses: helm/kind-action@v1.1.0
if: "steps.lint.outputs.changed == 'true' && ! contains(env.commitmsg, '[skip install]')" if: steps.list-changed.outputs.changed == 'true'
- name: Run chart-testing (install) - name: Run chart-testing (install)
uses: helm/chart-testing-action@v1.0.0 run: ct install --config .github/ct.yaml
if: "steps.lint.outputs.changed == 'true' && ! contains(env.commitmsg, '[skip install]')" if: steps.list-changed.outputs.changed == 'true'
with:
command: install
config: ct.yaml

View File

@ -1,10 +1,11 @@
name: Release Charts name: Release Charts
on: on:
push: push:
branches: branches:
- master - master
paths:
- "charts/**"
jobs: jobs:
release: release:
@ -13,6 +14,8 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Turnstyle - name: Turnstyle
uses: softprops/turnstyle@v1 uses: softprops/turnstyle@v1
@ -21,25 +24,47 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch history - name: Configure Git
run: git fetch --prune --unshallow 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 - name: Configure Git
run: | run: |
git config user.name "$GITHUB_ACTOR" git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" 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: | run: |
curl -fsSLo get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 if [[ -f index.yaml ]]; then
chmod 700 get_helm.sh export generated_date=$(date --utc +%FT%T.%9NZ)
./get_helm.sh sed -i -e "s/^generated:.*/generated: \"$generated_date\"/" index.yaml
- name: Add dependency chart repos git add index.yaml
run: | git commit -sm "Update generated timestamp [ci-skip]" || exit 0
helm repo add stable https://charts.helm.sh/stable git push
- name: Run chart-releaser fi
uses: helm/chart-releaser-action@v1.0.0
with:
charts_repo_url: https://k8s-at-home.com/charts/
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"