Skip to content

Commit f041669

Browse files
committed
Add workflow to automatically update go
Bump go to latest Signed-off-by: Praveen Rewar <8457124+praveenrewar@users.noreply.github.com>
1 parent 6e3423a commit f041669

File tree

8 files changed

+55
-35
lines changed

8 files changed

+55
-35
lines changed

.github/workflows/golangci-lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ jobs:
1212
name: lint
1313
runs-on: ubuntu-latest
1414
steps:
15-
- name: Set up Go
16-
uses: actions/setup-go@v5
17-
with:
18-
go-version: '1.22'
1915
- uses: actions/checkout@v4
2016
with:
2117
fetch-depth: '0'
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version-file: go.mod
2222
- name: golangci-lint
2323
uses: golangci/golangci-lint-action@v6
2424
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Set up Go
2323
uses: actions/setup-go@v5
2424
with:
25-
go-version: '1.22'
25+
go-version-file: go.mod
2626

2727
- name: Set up Cosign
2828
uses: sigstore/cosign-installer@v3

.github/workflows/test-gh-k8s-1.16.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@ jobs:
1010
name: Test GH 1.21
1111
runs-on: ubuntu-20.04
1212
steps:
13-
- name: Set up Go
14-
uses: actions/setup-go@v5
15-
with:
16-
go-version: '1.22'
1713
- name: Check out code into the Go module directory
1814
uses: actions/checkout@v4
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
1917
with:
20-
path: src/github.com/${{ github.repository }}
21-
fetch-depth: 0
18+
go-version-file: go.mod
2219
- name: Run Tests
2320
run: |
2421
set -e -x
2522
26-
export GOPATH=$(pwd)
27-
cd src/github.com/${{ github.repository }}
28-
2923
# Install ytt for build
3024
mkdir -p /tmp/bin
3125
export PATH=/tmp/bin:$PATH
@@ -42,7 +36,7 @@ jobs:
4236
# Ensure that there is no existing kapp installed
4337
rm -f /tmp/bin/kapp
4438
45-
./hack/build-binaries.sh
39+
./hack/build.sh
4640
4741
export KAPP_E2E_NAMESPACE=kapp-test
4842
kubectl create ns $KAPP_E2E_NAMESPACE

.github/workflows/test-gh.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@ jobs:
1010
name: Test GH
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Set up Go
14-
uses: actions/setup-go@v5
15-
with:
16-
go-version: '1.22'
1713
- name: Check out code into the Go module directory
1814
uses: actions/checkout@v4
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
1917
with:
20-
path: src/github.com/${{ github.repository }}
21-
fetch-depth: 0
18+
go-version-file: go.mod
2219
- name: Run Tests
2320
run: |
2421
set -e -x
2522
26-
export GOPATH=$(pwd)
27-
cd src/github.com/${{ github.repository }}
28-
2923
# Install ytt for build
3024
mkdir -p /tmp/bin
3125
export PATH=/tmp/bin:$PATH
@@ -42,7 +36,7 @@ jobs:
4236
# Ensure that there is no existing kapp installed
4337
rm -f /tmp/bin/kapp
4438
45-
./hack/build-binaries.sh
39+
./hack/build.sh
4640
4741
export KAPP_E2E_NAMESPACE=kapp-test
4842
kubectl create ns $KAPP_E2E_NAMESPACE

.github/workflows/trivy-scan.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ jobs:
1111
with:
1212
repo: carvel-dev/kapp
1313
tool: kapp
14-
goVersion: '1.22'
1514
secrets:
1615
githubToken: ${{ secrets.GITHUB_TOKEN }}
1716
slackWebhookURL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/update-go.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: go-updater
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 * * *'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-go:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4.1.2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go 1.x
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: 'stable'
20+
check-latest: true
21+
- name: Update Go
22+
run: go get go
23+
- name: Create Pull Request
24+
uses: peter-evans/create-pull-request@v6
25+
with:
26+
token: ${{ secrets.CARVEL_BOT_ACCESS_TOKEN }}
27+
committer: Carvel Bot <svc.bot.carvel@vmware.com>
28+
author: Carvel Bot <svc.bot.carvel@vmware.com>
29+
commit-message: |
30+
Bump go
31+
32+
Signed-off-by: Carvel Bot <svc.bot.carvel@vmware.com>
33+
title: Bump go
34+
delete-branch: true
35+
body: |
36+
Auto-generated by https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
37+
38+
Signed-off-by: Carvel Bot <svc.bot.carvel@vmware.com>
39+
base: develop
40+
branch: bump-go

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module carvel.dev/kapp
22

3-
go 1.22.3
3+
go 1.22.5
44

55
require (
66
github.com/cppforlife/cobrautil v0.0.0-20221130162803-acdfead391ef

hack/build.sh

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,14 @@
22

33
set -e -x -u
44

5-
function get_latest_git_tag {
6-
git describe --tags | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+'
7-
}
8-
9-
VERSION="${1:-`get_latest_git_tag`}"
10-
115
# makes builds reproducible
126
export CGO_ENABLED=0
13-
LDFLAGS="-X carvel.dev/kapp/pkg/kapp/version.Version=$VERSION -buildid="
147

158
go mod vendor
169
go mod tidy
1710
go fmt ./cmd/... ./pkg/... ./test/...
1811

19-
go build -ldflags="$LDFLAGS" -trimpath -o kapp ./cmd/kapp/...
12+
go build -trimpath -o kapp ./cmd/kapp/...
2013
./kapp version
2114

2215
# compile tests, but do not run them: https://github.com/golang/go/issues/15513#issuecomment-839126426

0 commit comments

Comments
 (0)