2020-12-16 01:16:53 +05:30
|
|
|
name: releaser
|
2020-08-11 05:46:13 +05:30
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2020-11-25 15:50:56 -08:00
|
|
|
- 'v*'
|
2022-01-15 17:14:22 -08:00
|
|
|
|
2020-08-11 05:46:13 +05:30
|
|
|
jobs:
|
2021-02-23 04:18:11 +05:30
|
|
|
release-init-kyverno:
|
2022-02-25 13:41:22 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2022-08-23 22:02:13 +02:00
|
|
|
uses: ./.github/workflows/reuse.yaml
|
2022-01-19 04:37:59 +05:30
|
|
|
with:
|
2022-08-31 06:22:46 +02:00
|
|
|
publish_command: ko-publish-kyvernopre
|
2022-01-19 04:37:59 +05:30
|
|
|
image_name: kyvernopre
|
|
|
|
tag: release
|
|
|
|
main: cmd/initContainer
|
2022-08-26 18:56:27 +02:00
|
|
|
secrets:
|
|
|
|
registry_username: ${{ github.actor }}
|
|
|
|
registry_password: ${{ secrets.CR_PAT }}
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
release-kyverno:
|
2022-02-25 13:41:22 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2022-08-23 22:02:13 +02:00
|
|
|
uses: ./.github/workflows/reuse.yaml
|
2022-01-19 04:37:59 +05:30
|
|
|
with:
|
2022-08-30 17:30:28 +02:00
|
|
|
publish_command: ko-publish-kyverno
|
2022-01-19 04:37:59 +05:30
|
|
|
image_name: kyverno
|
|
|
|
tag: release
|
|
|
|
main: cmd/kyverno
|
2022-08-26 18:56:27 +02:00
|
|
|
secrets:
|
|
|
|
registry_username: ${{ github.actor }}
|
|
|
|
registry_password: ${{ secrets.CR_PAT }}
|
2021-09-27 01:14:24 +05:30
|
|
|
|
2022-12-21 13:07:59 +01:00
|
|
|
release-cleanup-controller:
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
|
|
|
uses: ./.github/workflows/reuse.yaml
|
|
|
|
with:
|
|
|
|
publish_command: ko-publish-cleanup-controller
|
|
|
|
image_name: cleanup-controller
|
|
|
|
tag: release
|
|
|
|
main: cmd/cleanup-controller
|
|
|
|
secrets:
|
|
|
|
registry_username: ${{ github.actor }}
|
|
|
|
registry_password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
release-kyverno-cli:
|
2022-02-25 13:41:22 +05:30
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
id-token: write
|
2022-08-23 22:02:13 +02:00
|
|
|
uses: ./.github/workflows/reuse.yaml
|
2022-01-19 04:37:59 +05:30
|
|
|
with:
|
2022-08-30 17:30:28 +02:00
|
|
|
publish_command: ko-publish-cli
|
2022-01-19 04:37:59 +05:30
|
|
|
image_name: kyverno-cli
|
|
|
|
tag: release
|
|
|
|
main: cmd/cli/kubectl-kyverno
|
2022-08-26 18:56:27 +02:00
|
|
|
secrets:
|
|
|
|
registry_username: ${{ github.actor }}
|
|
|
|
registry_password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2022-12-21 19:13:21 +08:00
|
|
|
generate-init-kyverno-provenance:
|
|
|
|
needs: release-init-kyverno
|
|
|
|
permissions:
|
|
|
|
id-token: write # To sign the provenance.
|
|
|
|
packages: write # To upload assets to release.
|
|
|
|
actions: read #To read the workflow path.
|
|
|
|
# NOTE: The container generator workflow is not officially released as GA.
|
|
|
|
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.4.0
|
|
|
|
with:
|
|
|
|
image: ghcr.io/${{ github.repository_owner }}/kyvernopre
|
|
|
|
digest: "${{ needs.release-init-kyverno.outputs.init-container-digest }}"
|
|
|
|
registry-username: ${{ github.actor }}
|
|
|
|
secrets:
|
|
|
|
registry-password: ${{ secrets.CR_PAT }}
|
|
|
|
|
|
|
|
generate-kyverno-provenance:
|
|
|
|
needs: release-kyverno
|
|
|
|
permissions:
|
|
|
|
id-token: write # To sign the provenance.
|
|
|
|
packages: write # To upload assets to release.
|
|
|
|
actions: read #To read the workflow path.
|
|
|
|
# NOTE: The container generator workflow is not officially released as GA.
|
|
|
|
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.4.0
|
|
|
|
with:
|
|
|
|
image: ghcr.io/${{ github.repository_owner }}/kyverno
|
|
|
|
digest: "${{ needs.release-kyverno.outputs.kyverno-digest }}"
|
|
|
|
registry-username: ${{ github.actor }}
|
|
|
|
secrets:
|
|
|
|
registry-password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2022-12-21 13:07:59 +01:00
|
|
|
generate-cleanup-controller-provenance:
|
|
|
|
needs: release-cleanup-controller
|
|
|
|
permissions:
|
|
|
|
id-token: write # To sign the provenance.
|
|
|
|
packages: write # To upload assets to release.
|
|
|
|
actions: read #To read the workflow path.
|
|
|
|
# NOTE: The container generator workflow is not officially released as GA.
|
|
|
|
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.4.0
|
|
|
|
with:
|
|
|
|
image: ghcr.io/${{ github.repository_owner }}/cleanup-controller
|
|
|
|
digest: "${{ needs.release-cleanup-controller.outputs.cleanup-controller-digest }}"
|
|
|
|
registry-username: ${{ github.actor }}
|
|
|
|
secrets:
|
|
|
|
registry-password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2022-12-21 19:13:21 +08:00
|
|
|
generate-kyverno-cli-provenance:
|
|
|
|
needs: release-kyverno-cli
|
|
|
|
permissions:
|
|
|
|
id-token: write # To sign the provenance.
|
|
|
|
packages: write # To upload assets to release.
|
|
|
|
actions: read #To read the workflow path.
|
|
|
|
# NOTE: The container generator workflow is not officially released as GA.
|
|
|
|
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.4.0
|
|
|
|
with:
|
|
|
|
image: ghcr.io/${{ github.repository_owner }}/kyverno-cli
|
|
|
|
digest: "${{ needs.release-kyverno-cli.outputs.cli-digest }}"
|
|
|
|
registry-username: ${{ github.actor }}
|
|
|
|
secrets:
|
|
|
|
registry-password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2021-08-10 21:37:46 +05:30
|
|
|
create-release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- release-init-kyverno
|
|
|
|
- release-kyverno
|
2022-12-21 13:07:59 +01:00
|
|
|
- release-cleanup-controller
|
2021-08-10 21:37:46 +05:30
|
|
|
- release-kyverno-cli
|
|
|
|
steps:
|
|
|
|
- name: Set version
|
|
|
|
id: version
|
2022-11-30 12:53:30 +01:00
|
|
|
run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
2021-08-10 21:37:46 +05:30
|
|
|
|
|
|
|
- name: Checkout
|
2022-12-13 14:01:51 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
2022-12-14 08:47:55 +00:00
|
|
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
2022-12-20 21:51:55 +08:00
|
|
|
go-version: ~1.19.4
|
2021-08-10 21:37:46 +05:30
|
|
|
|
|
|
|
- name: Cache Go modules
|
2022-12-22 07:10:42 +00:00
|
|
|
uses: actions/cache@c17f4bf4666a8001b1a45c09eb7a485c41aa64c3 # pin@v3
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
2022-09-01 19:41:48 +02:00
|
|
|
path: |
|
|
|
|
~/.cache/go-build
|
|
|
|
~/go/pkg/mod
|
2021-08-10 21:37:46 +05:30
|
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-go-
|
2022-10-03 17:12:43 +02:00
|
|
|
|
|
|
|
- uses: creekorful/goreportcard-action@1f35ced8cdac2cba28c9a2f2288a16aacfd507f9 # pin@v1.0
|
2021-08-10 21:37:46 +05:30
|
|
|
|
|
|
|
- name: Make Release
|
|
|
|
env:
|
|
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
|
|
run: |
|
|
|
|
rm -rf release
|
|
|
|
mkdir release
|
|
|
|
make release-notes > release/release-notes.out
|
|
|
|
cat release/release-notes.out
|
2022-10-03 17:12:43 +02:00
|
|
|
|
2021-08-10 21:37:46 +05:30
|
|
|
- name: Run GoReleaser
|
2022-12-14 18:32:21 +00:00
|
|
|
uses: goreleaser/goreleaser-action@8f67e590f2d095516493f017008adc464e63adb1 # pin@v4.1.0
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
|
|
|
version: latest
|
|
|
|
args: release --rm-dist --debug --release-notes=release/release-notes.out
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-02-23 04:18:11 +05:30
|
|
|
|
2022-10-18 17:31:31 +08:00
|
|
|
push-and-sign-install-manifest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: write # needed to write releases
|
|
|
|
id-token: write # needed for keyless signing
|
|
|
|
packages: write # needed for ghcr access
|
|
|
|
needs:
|
|
|
|
- create-release
|
|
|
|
steps:
|
2022-10-21 15:29:55 +03:00
|
|
|
- name: Set version
|
|
|
|
id: version
|
2022-11-30 12:53:30 +01:00
|
|
|
run: echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
2022-10-21 15:29:55 +03:00
|
|
|
|
2022-10-18 17:31:31 +08:00
|
|
|
- name: Checkout
|
2022-12-13 14:01:51 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
2022-12-14 08:47:55 +00:00
|
|
|
uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
2022-12-20 21:51:55 +08:00
|
|
|
go-version: ~1.19.4
|
2022-10-18 17:31:31 +08:00
|
|
|
|
|
|
|
- name: Setup Flux CLI
|
2022-12-22 07:36:52 +00:00
|
|
|
uses: fluxcd/flux2/action@12e065cc432a18b0a4cff1a581e14c337e55732e # v0.38.1
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
|
|
|
version: 0.35.0
|
|
|
|
|
|
|
|
- name: Install Cosign
|
2022-12-02 10:47:04 +01:00
|
|
|
uses: sigstore/cosign-installer@9becc617647dfa20ae7b1151972e9b3a2c338a2b # v2.8.1
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
|
|
|
cosign-release: 'v1.13.0'
|
|
|
|
|
2022-10-03 17:12:43 +02:00
|
|
|
- name: Build yaml manifest
|
2022-12-19 16:26:07 +01:00
|
|
|
run: make codegen-manifest-release
|
2022-10-03 17:12:43 +02:00
|
|
|
|
|
|
|
- name: Upload yaml manifest
|
|
|
|
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 # pin@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
2022-12-19 16:26:07 +01:00
|
|
|
file: .manifest/release.yaml
|
2022-10-03 17:12:43 +02:00
|
|
|
asset_name: install.yaml
|
|
|
|
tag: ${{ github.ref }}
|
2022-10-20 21:23:27 +03:00
|
|
|
|
|
|
|
- name: Login to GHCR
|
|
|
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2022-10-14 15:48:32 +03:00
|
|
|
- name: Push manifests to GHCR with Flux
|
2022-10-18 17:31:31 +08:00
|
|
|
env:
|
|
|
|
CR_PAT_ARTIFACTS: ${{ secrets.CR_PAT_ARTIFACTS }}
|
2022-10-14 15:48:32 +03:00
|
|
|
run: |
|
2022-10-20 21:23:27 +03:00
|
|
|
set -e
|
2022-10-21 15:29:55 +03:00
|
|
|
mkdir -p config/.release-manifests
|
2022-12-19 16:26:07 +01:00
|
|
|
cp .manifest/release.yaml config/.release-manifests/install.yaml
|
2022-10-21 15:29:55 +03:00
|
|
|
cd config/.release-manifests/ && \
|
|
|
|
flux push artifact oci://ghcr.io/${{ github.repository_owner }}/manifests/kyverno:${{ steps.version.outputs.version }} \
|
2022-10-20 21:23:27 +03:00
|
|
|
--path="." \
|
|
|
|
--source="$(git config --get remote.origin.url)" \
|
2022-10-21 15:29:55 +03:00
|
|
|
--revision="${{ steps.version.outputs.version }}/$(git rev-parse HEAD)"
|
2022-10-20 21:23:27 +03:00
|
|
|
|
2022-10-14 15:48:32 +03:00
|
|
|
- name: Sign manifests in GHCR with Cosign
|
|
|
|
env:
|
|
|
|
COSIGN_EXPERIMENTAL: 1
|
|
|
|
run: |
|
2022-10-21 15:29:55 +03:00
|
|
|
cosign sign ghcr.io/${{ github.repository_owner }}/manifests/kyverno:${{ steps.version.outputs.version }}
|
2022-10-03 17:12:43 +02:00
|
|
|
|
2021-02-23 04:18:11 +05:30
|
|
|
release-cli-via-krew:
|
|
|
|
runs-on: ubuntu-latest
|
2022-10-03 17:12:43 +02:00
|
|
|
needs:
|
|
|
|
- create-release
|
2021-02-23 04:18:11 +05:30
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2022-12-13 14:01:51 +00:00
|
|
|
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
|
2021-02-23 04:18:11 +05:30
|
|
|
|
|
|
|
- name: Unshallow
|
|
|
|
run: git fetch --prune --unshallow
|
|
|
|
|
|
|
|
- name: Check Tag
|
|
|
|
id: check-tag
|
|
|
|
run: |
|
|
|
|
if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
2022-11-30 12:53:30 +01:00
|
|
|
echo "match=true" >> $GITHUB_OUTPUT
|
2021-02-23 04:18:11 +05:30
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Update new version in krew-index
|
|
|
|
if: steps.check-tag.outputs.match == 'true'
|
2022-12-06 08:49:38 +00:00
|
|
|
uses: rajatjindal/krew-release-bot@92da038bbf995803124a8e50ebd438b2f37bbbb0 # pin@v0.0.43
|