Skip to content

Commit de56ce2

Browse files
authored
Unroll int128/kubebuilder-workflows (#1422)
* Unroll int128/kubebuilder-workflows * Refactor
1 parent b190fcc commit de56ce2

File tree

3 files changed

+83
-27
lines changed

3 files changed

+83
-27
lines changed

.github/workflows/docker.yaml renamed to .github/workflows/build.yaml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: docker
1+
name: build
22

33
on:
44
pull_request:
55
paths:
6-
- .github/workflows/docker.yaml
6+
- .github/workflows/build.yaml
77
- Dockerfile
88
- go.*
99
- api/**
@@ -18,7 +18,7 @@ on:
1818
tags:
1919
- v*
2020
paths:
21-
- .github/workflows/docker.yaml
21+
- .github/workflows/build.yaml
2222
- Dockerfile
2323
- go.*
2424
- cmd/**
@@ -29,7 +29,7 @@ on:
2929
- '!**/*.md'
3030

3131
jobs:
32-
build:
32+
container:
3333
runs-on: ubuntu-latest
3434
timeout-minutes: 10
3535
permissions:
@@ -74,13 +74,24 @@ jobs:
7474
with:
7575
metadata: ${{ steps.build.outputs.metadata }}
7676

77-
release:
78-
needs: build
79-
uses: int128/kubebuilder-workflows/.github/workflows/release.yaml@e4ad31a438f188f70bde87827a8dbe466e623dea # v1.5.0
77+
manifest:
78+
needs: container
79+
runs-on: ubuntu-latest
80+
timeout-minutes: 10
8081
permissions:
8182
contents: write
82-
with:
83-
controller-image: ${{ needs.build.outputs.image-uri }}
83+
steps:
84+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
85+
- run: kustomize edit set image controller="$controller_image"
86+
working-directory: config/manager
87+
env:
88+
controller_image: ${{ needs.container.outputs.image-uri }}
89+
- run: kustomize build config/default > "${RUNNER_TEMP}/${GITHUB_REPOSITORY##*/}.yaml"
90+
- run: cat "${RUNNER_TEMP}/${GITHUB_REPOSITORY##*/}.yaml"
91+
- if: github.ref_type == 'tag'
92+
run: gh release upload "$GITHUB_REF_NAME" "${RUNNER_TEMP}/${GITHUB_REPOSITORY##*/}.yaml" --clobber
93+
env:
94+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8495

8596
e2e-test:
8697
runs-on: ubuntu-latest

.github/workflows/go.yaml

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,31 @@ on:
1717
- Makefile
1818

1919
jobs:
20-
go:
21-
uses: int128/kubebuilder-workflows/.github/workflows/go.yaml@e4ad31a438f188f70bde87827a8dbe466e623dea # v1.5.0
22-
permissions:
23-
contents: write
24-
pull-requests: write
25-
with:
26-
go-version-file: go.mod
27-
cache-dependency-path: go.sum
20+
test:
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 10
23+
steps:
24+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
26+
with:
27+
go-version-file: go.mod
28+
cache-dependency-path: go.sum
29+
- run: make test
30+
- run: make lint
2831

29-
fix-go-mod-replace:
32+
generate:
3033
runs-on: ubuntu-latest
3134
timeout-minutes: 10
35+
permissions:
36+
contents: write
37+
pull-requests: write
3238
steps:
33-
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
34-
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
39+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
3541
with:
3642
go-version-file: go.mod
3743
cache-dependency-path: go.sum
3844
- run: bash hack/fix_go_mod_replace.sh
39-
- uses: int128/update-generated-files-action@f6dc44e35ce252932e9018f1c38d1e2a4ff80e14 # v2.60.0
45+
- run: make fmt
46+
- run: make generate manifests
47+
- uses: int128/update-generated-files-action@65b9a7ae3ededc5679d78343f58fbebcf1ebd785 # v2.57.0

.github/workflows/manifest.yaml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,49 @@ on:
88
- .github/workflows/manifest.yaml
99

1010
jobs:
11-
manifest:
12-
uses: int128/kubebuilder-workflows/.github/workflows/manifest.yaml@e6411bdb370db1900260cf86e13c20980c3eaa82 # v1
11+
diff:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
1314
permissions:
1415
contents: read
1516
pull-requests: write
16-
with:
17-
kustomization: |
18-
config/default/kustomization.yaml
19-
e2e_test/**/kustomization.yaml
17+
steps:
18+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19+
with:
20+
ref: ${{ github.head_ref }}
21+
path: head
22+
- uses: int128/kustomize-action@b5d955eaf39fd3e02589771d3e695e7550d7f756 # v1.157.0
23+
id: kustomize-head
24+
with:
25+
base-directory: head
26+
write-individual-files: true
27+
kustomization: |
28+
config/default/kustomization.yaml
29+
e2e_test/**/kustomization.yaml
30+
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
with:
33+
ref: ${{ github.base_ref }}
34+
path: base
35+
- uses: int128/kustomize-action@b5d955eaf39fd3e02589771d3e695e7550d7f756 # v1.157.0
36+
id: kustomize-base
37+
with:
38+
base-directory: base
39+
write-individual-files: true
40+
ignore-kustomize-error: true
41+
kustomization: |
42+
config/default/kustomization.yaml
43+
e2e_test/**/kustomization.yaml
44+
45+
- uses: int128/diff-action@db6cce01542cb26e181798736eea1e71f5d36706 # v1.51.0
46+
id: diff
47+
with:
48+
base: ${{ steps.kustomize-base.outputs.directory }}
49+
head: ${{ steps.kustomize-head.outputs.directory }}
50+
comment: false
51+
- uses: int128/comment-action@a20dbdebd79ab886a1e7a20d16bfa7dbaa732e5a # v1.33.0
52+
with:
53+
update-if-exists: replace
54+
post: |
55+
## kustomize diff
56+
${{ steps.diff.outputs.comment-body }}

0 commit comments

Comments
 (0)