这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Release

on:
push:
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'

- name: Set environment variables
run: |
# Strip 'v' prefix from tag name for version
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./kubechain
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Install Kustomize
run: |
cd kubechain
make kustomize

- name: Generate release manifests
run: |
cd kubechain
mkdir -p config/release

# Set the image to the versioned image
cd config/manager && ../../bin/kustomize edit set image controller=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
cd ../..

# Generate the full installation manifest
bin/kustomize build config/default > config/release/v${{ env.VERSION }}.yaml

# Generate CRD-only manifest
bin/kustomize build config/crd > config/release/v${{ env.VERSION }}-crd.yaml

# Also update the latest manifests
cp config/release/v${{ env.VERSION }}.yaml config/release/latest.yaml
cp config/release/v${{ env.VERSION }}-crd.yaml config/release/latest-crd.yaml

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ env.TAG }}
draft: false
prerelease: false
files: |
kubechain/config/release/v${{ env.VERSION }}.yaml
kubechain/config/release/v${{ env.VERSION }}-crd.yaml

- name: Commit updated release manifests
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add kubechain/config/release/v${{ env.VERSION }}.yaml
git add kubechain/config/release/v${{ env.VERSION }}-crd.yaml
git add kubechain/config/release/latest.yaml
git add kubechain/config/release/latest-crd.yaml
git commit -m "chore: update release manifests for ${{ env.TAG }}"
git push
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ clean-all: undeploy-samples undeploy-operator undeploy-otel cluster-down ## Clea

.PHONY: githooks
githooks:
ln -s hack/git_pre_push.sh .git/hooks/pre-push
ln -s ${PWD}/hack/git_pre_push.sh ${PWD}/.git/hooks/pre-push