Skip to content

Commit e7c407f

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

File tree

1 file changed

+57
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)