File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Release
2
+
3
+ on :
4
+ push :
5
+ branches : [ "main" ]
6
+
7
+ jobs :
8
+
9
+ build :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v4
13
+
14
+ - name : Set up Go
15
+ uses : actions/setup-go@v4
16
+ with :
17
+ go-version : ' 1.21'
18
+
19
+ - name : Build
20
+ run : |
21
+ BUILD=$(git log --format='%H' -n 1)
22
+ VERSION="dev"
23
+ GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
24
+ -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nic-supportpkg
25
+ tar czvf release/kubectl-nic-supportpkg_${VERSION}_linux_amd64.tar.gz -C release kubectl-nic-supportpkg
26
+
27
+ GOOS=linux GOARCH=arm64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
28
+ -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nic-supportpkg
29
+ tar czvf release/kubectl-nic-supportpkg_${VERSION}_linux_arm64.tar.gz -C release kubectl-nic-supportpkg
30
+
31
+ GOOS=darwin GOARCH=amd64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
32
+ -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nic-supportpkg
33
+ tar czvf release/kubectl-nic-supportpkg_${VERSION}_darwin_amd64.tar.gz -C release kubectl-nic-supportpkg
34
+
35
+ GOOS=darwin GOARCH=arm64 go build -ldflags "-w -s -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Build=$BUILD\
36
+ -X github.com/nginxinc/nginx-k8s-supportpkg/pkg/version.Version=$VERSION" -o release/kubectl-nic-supportpkg
37
+ tar czvf release/kubectl-nic-supportpkg_${VERSION}_darwin_arm64.tar.gz -C release kubectl-nic-supportpkg
38
+
39
+ - name : Upload Artifacts
40
+ uses : actions/upload-artifact@v4
41
+ with :
42
+ name : release-artifacts
43
+ path : release/**/*.gz
Original file line number Diff line number Diff line change 4
4
"fmt"
5
5
"github.com/nginxinc/nginx-k8s-supportpkg/pkg/data_collector"
6
6
"github.com/nginxinc/nginx-k8s-supportpkg/pkg/jobs"
7
+ "github.com/nginxinc/nginx-k8s-supportpkg/pkg/version"
7
8
"github.com/spf13/cobra"
8
9
"os"
9
10
)
@@ -24,6 +25,8 @@ func Execute() {
24
25
os .Exit (1 )
25
26
}
26
27
28
+ collector .Logger .Printf ("Starting kubectl-nic-suportpkg - version: %s - build: %s" , version .Version , version .Build )
29
+
27
30
if collector .AllNamespacesExist () == true {
28
31
for _ , job := range jobs .JobList () {
29
32
fmt .Printf ("Running job %s..." , job .Name )
Original file line number Diff line number Diff line change
1
+ package version
2
+
3
+ // Version and Build are injected in the build process
4
+ var Version = "dev"
5
+ var Build = "dev"
You can’t perform that action at this time.
0 commit comments