2024-01-27 23:32:42 +01:00
|
|
|
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
|
|
|
|
|
2021-07-14 20:10:41 +01:00
|
|
|
name: helm-release
|
2023-01-06 16:24:55 +01:00
|
|
|
|
2023-06-30 13:44:57 +02:00
|
|
|
permissions: {}
|
|
|
|
|
2021-07-14 20:10:41 +01:00
|
|
|
on:
|
|
|
|
push:
|
2021-08-20 18:06:58 -04:00
|
|
|
tags:
|
2022-04-26 23:52:45 -04:00
|
|
|
- 'kyverno-chart-v*'
|
|
|
|
- 'kyverno-policies-chart-v*'
|
2022-09-09 01:34:09 +08:00
|
|
|
- 'kyverno-chart-*'
|
|
|
|
- 'kyverno-policies-chart-*'
|
2021-07-14 20:10:41 +01:00
|
|
|
|
|
|
|
jobs:
|
2021-07-21 01:06:56 +01:00
|
|
|
helm-tests:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-10-24 09:42:17 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-09-27 10:24:27 +02:00
|
|
|
- name: Setup caches
|
|
|
|
uses: ./.github/actions/setup-caches
|
|
|
|
timeout-minutes: 5
|
|
|
|
continue-on-error: true
|
2023-01-05 16:52:52 +01:00
|
|
|
- name: Setup build env
|
|
|
|
uses: ./.github/actions/setup-build-env
|
2023-08-30 22:44:51 +02:00
|
|
|
timeout-minutes: 10
|
2024-10-25 15:40:00 +08:00
|
|
|
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
|
2021-07-21 01:06:56 +01:00
|
|
|
with:
|
|
|
|
python-version: 3.7
|
|
|
|
- name: Set up chart-testing
|
2023-11-06 14:33:04 +00:00
|
|
|
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
|
2021-07-21 01:06:56 +01:00
|
|
|
- name: Run chart-testing (lint)
|
2023-10-26 18:26:26 +05:30
|
|
|
run: ct lint --target-branch=main --check-version-increment=false --validate-maintainers=false
|
2021-07-21 01:06:56 +01:00
|
|
|
|
2023-04-03 15:56:52 +08:00
|
|
|
linter-artifacthub:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
|
|
|
image: artifacthub/ah
|
|
|
|
options: --user root
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-10-24 09:42:17 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-04-03 15:56:52 +08:00
|
|
|
- name: Run ah lint
|
|
|
|
working-directory: ./charts/
|
|
|
|
run: ah lint
|
|
|
|
|
2021-07-14 20:10:41 +01:00
|
|
|
create-release:
|
|
|
|
runs-on: ubuntu-latest
|
2021-07-21 01:06:56 +01:00
|
|
|
needs: helm-tests
|
2022-10-12 23:14:44 +03:00
|
|
|
permissions:
|
|
|
|
contents: write
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
pages: write
|
2021-07-14 20:10:41 +01:00
|
|
|
steps:
|
2021-07-19 21:01:17 +01:00
|
|
|
- name: Checkout
|
2024-10-24 09:42:17 +00:00
|
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
2023-09-27 10:24:27 +02:00
|
|
|
- name: Setup caches
|
|
|
|
uses: ./.github/actions/setup-caches
|
|
|
|
timeout-minutes: 5
|
|
|
|
continue-on-error: true
|
2023-01-05 16:52:52 +01:00
|
|
|
- name: Setup build env
|
|
|
|
uses: ./.github/actions/setup-build-env
|
2023-08-30 22:44:51 +02:00
|
|
|
timeout-minutes: 10
|
2022-09-02 10:55:41 +02:00
|
|
|
|
2021-07-14 20:10:41 +01:00
|
|
|
- name: Install Helm
|
2024-04-16 09:54:59 +00:00
|
|
|
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
|
2021-07-14 20:10:41 +01:00
|
|
|
with:
|
2022-12-27 15:58:18 +03:00
|
|
|
version: v3.10.3
|
2021-07-14 20:10:41 +01:00
|
|
|
|
2022-10-12 23:14:44 +03:00
|
|
|
- name: Install Cosign
|
2024-10-07 09:19:25 +00:00
|
|
|
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
|
2022-10-12 23:14:44 +03:00
|
|
|
|
2022-04-26 23:52:45 -04:00
|
|
|
- name: Set version
|
|
|
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Create charts tmp directory
|
|
|
|
run: |
|
|
|
|
mkdir charts-tmp
|
|
|
|
if [[ "$RELEASE_VERSION" = "kyverno-policies-chart-v"* ]]; then
|
|
|
|
cp -a charts/kyverno-policies charts-tmp/kyverno-policies
|
|
|
|
fi
|
|
|
|
if [[ "$RELEASE_VERSION" = "kyverno-chart-v"* ]]; then
|
|
|
|
cp -a charts/kyverno charts-tmp/kyverno
|
|
|
|
fi
|
2022-09-12 15:36:46 +08:00
|
|
|
if [[ "$RELEASE_VERSION" = "kyverno-policies-chart-"* ]]; then
|
|
|
|
cp -a charts/kyverno-policies charts-tmp/kyverno-policies
|
|
|
|
fi
|
|
|
|
if [[ "$RELEASE_VERSION" = "kyverno-chart-"* ]]; then
|
|
|
|
cp -a charts/kyverno charts-tmp/kyverno
|
|
|
|
fi
|
2022-04-26 23:52:45 -04:00
|
|
|
|
2021-07-14 20:10:41 +01:00
|
|
|
- name: Run chart-releaser
|
2022-12-02 12:52:56 +00:00
|
|
|
uses: stefanprodan/helm-gh-pages@0ad2bb377311d61ac04ad9eb6f252fb68e207260 #v1.7.0
|
2021-07-14 20:10:41 +01:00
|
|
|
with:
|
2021-07-20 12:49:37 -07:00
|
|
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
2022-02-21 10:50:42 -05:00
|
|
|
linting: off
|
2022-04-26 23:52:45 -04:00
|
|
|
charts_dir: charts-tmp
|
2022-09-01 22:15:33 +03:00
|
|
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
run: |
|
|
|
|
helm registry login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
|
|
|
|
|
|
|
|
- name: Publish OCI Charts
|
|
|
|
run: |
|
|
|
|
for dir in `find charts-tmp -maxdepth 1 -mindepth 1 -type d -print`; do
|
|
|
|
chart=${dir##*/}
|
|
|
|
echo "Found chart: ${chart}"
|
2022-10-02 23:20:33 +03:00
|
|
|
helm package charts-tmp/${chart} --destination .dist
|
2022-12-27 15:58:18 +03:00
|
|
|
helm push .dist/${chart}-*.tgz oci://ghcr.io/${{ github.repository_owner }}/charts |& tee .digest
|
2023-06-30 15:40:08 +02:00
|
|
|
cosign login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
|
2023-07-06 14:19:21 +02:00
|
|
|
cosign sign --yes ghcr.io/${{ github.repository_owner }}/charts/${chart}@$(cat .digest | awk -F "[, ]+" '/Digest/{print $NF}')
|
2022-10-02 23:20:33 +03:00
|
|
|
done
|