Skip to content

Commit 2293989

Browse files
(ci) - Add test for release mock
1 parent cf5dbb3 commit 2293989

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Test GoReleaser and CLI Version
2+
3+
on:
4+
push:
5+
paths:
6+
- 'pkg/cmd/**'
7+
- 'build/.goreleaser.yml'
8+
- '.github/workflows/release-version-ci.yml'
9+
pull_request:
10+
paths:
11+
- 'pkg/cmd/**'
12+
- 'build/.goreleaser.yml'
13+
- '.github/workflows/release-version-ci.yml'
14+
15+
jobs:
16+
mock-build:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Set up Go
26+
uses: actions/setup-go@v5
27+
with:
28+
go-version-file: go.mod
29+
30+
- name: Clean dist directory
31+
run: rm -rf dist || true
32+
33+
- name: Create temporary git tag
34+
run: |
35+
git tag v4.5.3-rc.1
36+
37+
- name: Install Syft to generate SBOMs
38+
run: |
39+
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b $HOME/bin
40+
echo "$HOME/bin" >> $GITHUB_PATH
41+
42+
- name: Run GoReleaser in mock mode using tag
43+
uses: goreleaser/goreleaser-action@v6
44+
with:
45+
version: v2.7.0
46+
args: release --skip=publish --clean -f ./build/.goreleaser.yml
47+
48+
- name: Init project using built kubebuilder binary and check cliVersion
49+
run: |
50+
mkdir test-operator && cd test-operator
51+
go mod init test-operator
52+
chmod +x ../dist/kubebuilder_linux_amd64_v1/kubebuilder
53+
../dist/kubebuilder_linux_amd64_v1/kubebuilder init --domain example.com
54+
55+
echo "PROJECT file content:"
56+
cat PROJECT
57+
58+
echo "Verifying cliVersion value..."
59+
grep '^cliVersion: 4.5.3-rc.1$' PROJECT

0 commit comments

Comments
 (0)