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
|
|
|
|
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 }}
|
|
|
|
|
2021-08-10 21:37:46 +05:30
|
|
|
create-release:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- release-init-kyverno
|
|
|
|
- release-kyverno
|
|
|
|
- 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-05 09:43:16 +01:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3.1.0
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
2022-12-06 07:49:45 +01:00
|
|
|
uses: actions/setup-go@d0a58c1c4d2b25278816e339b944508c875f3613 # pin@v3.4.0
|
2021-08-10 21:37:46 +05:30
|
|
|
with:
|
2022-09-25 12:11:28 +02:00
|
|
|
go-version: ~1.18.6
|
2021-08-10 21:37:46 +05:30
|
|
|
|
|
|
|
- name: Cache Go modules
|
2022-12-05 08:58:10 +01:00
|
|
|
uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 # 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-05 16:57:48 +00:00
|
|
|
uses: goreleaser/goreleaser-action@b508e2e3ef3b19d4e4146d4f8fb3ba9db644a757 # pin@v3.2.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-05 09:43:16 +01:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3.1.0
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
2022-12-06 07:49:45 +01:00
|
|
|
uses: actions/setup-go@d0a58c1c4d2b25278816e339b944508c875f3613 # pin@v3.4.0
|
2022-10-18 17:31:31 +08:00
|
|
|
with:
|
|
|
|
go-version: ~1.18.6
|
|
|
|
|
|
|
|
- name: Setup Flux CLI
|
|
|
|
uses: fluxcd/flux2/action@1fa48bf916fa5ce5800190f8a0c9fdf7ae86559b # v0.35.0
|
|
|
|
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
|
|
|
|
run: make codegen-release
|
|
|
|
|
|
|
|
- name: Upload yaml manifest
|
|
|
|
uses: svenstaro/upload-release-action@133984371c30d34e38222a64855679a414cb7575 # pin@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: config/.release/install.yaml
|
|
|
|
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
|
|
|
|
cp config/.release/install.yaml config/.release-manifests/install.yaml
|
|
|
|
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-05 09:43:16 +01:00
|
|
|
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # pin@v3.1.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
|