11
11
12
12
env :
13
13
REGISTRY : ghcr.io
14
- IMAGE_NAME : ${{ github.repository }}
15
14
GOPRIVATE : github.com/weaveworks/cluster-controller
16
15
17
16
jobs :
18
- release-please :
19
- runs-on : ubuntu-latest
20
- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
21
- permissions :
22
- contents : write
23
- pull-requests : write
24
- issues : write
25
- repository-projects : write
26
- outputs :
27
- release_created : ${{ steps.release.outputs.release_created }}
28
- tag_name : ${{ steps.release.outputs.tag_name }}
29
- steps :
30
- - name : Run release-please
31
- id : release
32
- uses : googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
33
- with :
34
- release-type : go
35
-
36
17
test :
37
18
runs-on : ubuntu-latest
38
19
permissions :
88
69
needs : [test]
89
70
permissions :
90
71
contents : read # for actions/checkout to fetch code
91
- packages : write # for pushing to ghcr.io
92
72
steps :
93
73
- name : Checkout
94
74
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -100,43 +80,42 @@ jobs:
100
80
id : get_version
101
81
run : echo "VERSION=$(make version)" >> $GITHUB_OUTPUT
102
82
103
- - name : Log in to the Container registry
104
- uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
105
- with :
106
- registry : ${{ env.REGISTRY }}
107
- username : ${{ github.actor }}
108
- password : ${{ secrets.GITHUB_TOKEN }}
109
-
110
- - name : Extract metadata (tags, labels) for Docker
111
- id : meta
112
- uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
113
- with :
114
- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
115
- tags : |
116
- type=ref,event=branch
117
- type=ref,event=pr
118
- type=semver,pattern={{version}}
119
- type=semver,pattern={{major}}.{{minor}}
120
- type=raw,value=latest,enable={{is_default_branch}}
121
-
122
83
- name : Configure git for private modules
123
84
env :
124
85
GITHUB_BUILD_USERNAME : ${{ secrets.BUILD_BOT_USER }}
125
86
GITHUB_BUILD_TOKEN : ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }}
126
87
run : git config --global url."https://${GITHUB_BUILD_USERNAME}:${GITHUB_BUILD_TOKEN}@github.com".insteadOf "https://github.com"
127
88
128
- - name : Build and push Docker image
89
+ - name : Build Docker image (test only)
129
90
uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
130
91
with :
131
92
context : .
132
- push : true
133
- tags : ${{ steps.meta.outputs.tags }}
134
- labels : ${{ steps.meta.outputs.labels }}
93
+ push : false
94
+ tags : gitopssets-controller:test
135
95
build-args : VERSION=${{ steps.get_version.outputs.VERSION }}
136
96
97
+ release-please :
98
+ runs-on : ubuntu-latest
99
+ needs : [build]
100
+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
101
+ permissions :
102
+ contents : write
103
+ pull-requests : write
104
+ issues : write
105
+ repository-projects : write
106
+ outputs :
107
+ release_created : ${{ steps.release.outputs.release_created }}
108
+ tag_name : ${{ steps.release.outputs.tag_name }}
109
+ steps :
110
+ - name : Run release-please
111
+ id : release
112
+ uses : googleapis/release-please-action@7987652d64b4581673a76e33ad5e98e3dd56832f # v4.1.3
113
+ with :
114
+ release-type : go
115
+
137
116
release :
138
117
runs-on : ubuntu-latest
139
- needs : [build, test, release-please]
118
+ needs : [release-please]
140
119
# only run when release-please creates a release
141
120
if : needs.release-please.outputs.release_created == 'true'
142
121
permissions :
@@ -170,6 +149,31 @@ jobs:
170
149
username : ${{ github.actor }}
171
150
password : ${{ secrets.GITHUB_TOKEN }}
172
151
152
+ - name : Configure git for private modules
153
+ env :
154
+ GITHUB_BUILD_USERNAME : ${{ secrets.BUILD_BOT_USER }}
155
+ GITHUB_BUILD_TOKEN : ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }}
156
+ run : git config --global url."https://${GITHUB_BUILD_USERNAME}:${GITHUB_BUILD_TOKEN}@github.com".insteadOf "https://github.com"
157
+
158
+ - name : Build and push release Docker image
159
+ uses : docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
160
+ with :
161
+ context : .
162
+ push : true
163
+ tags : |
164
+ ghcr.io/weaveworks/gitopssets-controller:${{ steps.get_version.outputs.VERSION }}
165
+ ghcr.io/weaveworks/gitopssets-controller:latest
166
+ labels : |
167
+ org.opencontainers.image.title=GitOpsSet Controller
168
+ org.opencontainers.image.description=A controller for managing GitOpsSet resources
169
+ org.opencontainers.image.source=https://github.com/weaveworks/gitopssets-controller
170
+ org.opencontainers.image.url=https://github.com/weaveworks/gitopssets-controller
171
+ org.opencontainers.image.documentation=https://github.com/weaveworks/gitopssets-controller
172
+ org.opencontainers.image.version=${{ steps.get_version.outputs.VERSION }}
173
+ org.opencontainers.image.revision=${{ github.sha }}
174
+ org.opencontainers.image.licenses=Apache-2.0
175
+ build-args : VERSION=${{ steps.get_version.outputs.VERSION }}
176
+
173
177
- name : Build and publish Helm chart
174
178
run : |
175
179
make publish-helm-chart
0 commit comments