Skip to content

Commit c7e71cf

Browse files
ErikJiangpacoxu
authored andcommitted
add release ci
Signed-off-by: bo.jiang <[email protected]>
1 parent 3b52727 commit c7e71cf

22 files changed

+1854
-101
lines changed

.github/release.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
changelog:
2+
categories:
3+
- title: ❗ API Changes
4+
labels:
5+
- kind/api-change
6+
- title: 🚀 Features
7+
labels:
8+
- kind/feature
9+
- title: 🐛 Bug Fixes
10+
labels:
11+
- kind/bug
12+
- kind/regression
13+
- title: 📖 Documentation
14+
labels:
15+
- kind/documentation
16+
- title: Dependencies
17+
labels:
18+
- area/dependency
19+
- title: 🌱 Others
20+
labels:
21+
- "*"

.github/workflows/lint.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
name: Lint
22

33
on:
4-
push:
54
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
610

711
jobs:
812
lint:
913
name: Run on Ubuntu
1014
runs-on: ubuntu-latest
1115
steps:
12-
- name: Clone the code
13-
uses: actions/checkout@v4
16+
- name: Clone the code
17+
uses: actions/checkout@v4
1418

15-
- name: Setup Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: '~1.22'
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '~1.22'
1923

20-
- name: Run linter
21-
uses: golangci/golangci-lint-action@v6
22-
with:
23-
version: v1.61
24+
- name: Run linter
25+
uses: golangci/golangci-lint-action@v6
26+
with:
27+
version: v1.61

.github/workflows/release.yaml

+45-28
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,57 @@
11
name: Releases
2+
23
on:
34
push:
4-
branches:
5-
- master-dev
6-
7-
env:
8-
PUSH: 'true'
9-
PRE_RELEASE: GA
10-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11-
GO_VERSION: "1.22.0"
5+
tags:
6+
- v*
127

138
permissions:
149
contents: write
1510
packages: write
1611

1712
jobs:
1813
releases:
19-
name: release
14+
name: Create draft release
2015
runs-on: ubuntu-latest
2116
steps:
22-
- name: Clone the code
23-
uses: actions/checkout@v4
24-
- name: Setup Go
25-
uses: actions/setup-go@v5
26-
with:
27-
go-version: '~1.22'
28-
- name: Set up QEMU
29-
uses: docker/setup-qemu-action@v3
30-
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v3
32-
- name: Log into registry ghcr.io
33-
uses: docker/login-action@v3
34-
with:
35-
registry: ghcr.io
36-
username: ${{ github.actor }}
37-
password: ${{ secrets.GITHUB_TOKEN }}
38-
- name: Build and push
39-
run: |
40-
make docker-buildx
17+
- name: Clone the code
18+
uses: actions/checkout@v4
19+
- name: Set version info
20+
run: |
21+
echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
22+
PREVIOUS_VERSION=$(git tag --sort=-creatordate | sed -n 2p)
23+
if [ -z "$PREVIOUS_VERSION" ]; then
24+
PREVIOUS_VERSION=$(git rev-list --max-parents=0 HEAD)
25+
fi
26+
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV
27+
echo "RELEASE_BRANCH=release-$(echo ${GITHUB_REF_NAME} | grep -Eo '[0-9]\.[0-9]+')" >> $GITHUB_ENV
28+
echo "RELEASE_TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV
29+
echo "IMAGE_REPO=$(echo ${GITHUB_REPOSITORY} | awk -F "/" '{print $1}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
30+
echo "GH_ORG_NAME=${GITHUB_REPOSITORY%%/*}" >> $GITHUB_ENV
31+
- name: Setup Go
32+
uses: actions/setup-go@v5
33+
with:
34+
go-version: '~1.22'
35+
- name: Set up QEMU
36+
uses: docker/setup-qemu-action@v3
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@v3
39+
- name: Log into registry ghcr.io
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
- name: Build and push
46+
run: |
47+
echo "Release tag is: $RELEASE_TAG"
48+
make docker-buildx
49+
- name: Run release
50+
run: |
51+
echo "Version is: $VERSION"
52+
echo "Previous version is: $PREVIOUS_VERSION"
53+
echo "Release branch is: $RELEASE_BRANCH"
54+
echo "Release tag is: $RELEASE_TAG"
55+
make release
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-e2e.yml

+24-20
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,39 @@
11
name: E2E Tests
22

33
on:
4-
push:
54
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
610

711
jobs:
812
test-e2e:
913
name: Run on Ubuntu
1014
runs-on: ubuntu-latest
1115
steps:
12-
- name: Clone the code
13-
uses: actions/checkout@v4
16+
- name: Clone the code
17+
uses: actions/checkout@v4
1418

15-
- name: Setup Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: '~1.22'
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '~1.22'
1923

20-
- name: Install the latest version of kind
21-
run: |
22-
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
23-
chmod +x ./kind
24-
sudo mv ./kind /usr/local/bin/kind
24+
- name: Install the latest version of kind
25+
run: |
26+
curl -Lo ./kind https://kind.sigs.k8s.io/dl/latest/kind-linux-amd64
27+
chmod +x ./kind
28+
sudo mv ./kind /usr/local/bin/kind
2529
26-
- name: Verify kind installation
27-
run: kind version
30+
- name: Verify kind installation
31+
run: kind version
2832

29-
- name: Create kind cluster
30-
run: kind create cluster
33+
- name: Create kind cluster
34+
run: kind create cluster
3135

32-
- name: Running Test e2e
33-
run: |
34-
go mod tidy
35-
make test-e2e
36+
- name: Running Test e2e
37+
run: |
38+
go mod tidy
39+
make test-e2e

.github/workflows/test.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
name: Tests
22

33
on:
4-
push:
54
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
610

711
jobs:
812
test:
913
name: Run on Ubuntu
1014
runs-on: ubuntu-latest
1115
steps:
12-
- name: Clone the code
13-
uses: actions/checkout@v4
16+
- name: Clone the code
17+
uses: actions/checkout@v4
1418

15-
- name: Setup Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: '~1.22'
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: '~1.22'
1923

20-
- name: Running Tests
21-
run: |
22-
go mod tidy
23-
make test
24+
- name: Running Tests
25+
run: |
26+
go mod tidy
27+
make test

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,7 @@ go.work
2626
*.swo
2727
*~
2828
.tiltbuild/*
29+
_artifacts/*
30+
hack/tools/bin/
31+
out/
32+
.trunk/

.goreleaser.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
builds: []
2+
3+
archives: []
4+
5+
release:
6+
discussion_category_name: General
7+
extra_files:
8+
- glob: ./templates/*.yaml
9+
- glob: ./out/*
10+
draft: true

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ FROM golang:1.22 AS builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

6+
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
7+
ARG goproxy=https://proxy.golang.org
8+
ENV GOPROXY=$goproxy
9+
610
WORKDIR /workspace
711
# Copy the Go Modules manifests
812
COPY go.mod go.mod

0 commit comments

Comments
 (0)