Skip to content

Commit 227abd9

Browse files
author
Baton Admin
committed
chore: update dependencies workflow via baton-admin
1 parent bd059d7 commit 227abd9

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This file is managed by baton-admin. DO NOT EDIT!!!
2+
name: Update Go version and dependencies
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- ".versions.yaml"
10+
11+
jobs:
12+
update-versions:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
token: ${{ secrets.RELENG_GITHUB_TOKEN }}
18+
- name: "Get expected Go version"
19+
uses: mathiasvr/[email protected]
20+
id: go-version
21+
with:
22+
run: |
23+
yq -r '.go-version' .versions.yaml | tr -d '\n'
24+
- name: "Update go.mod"
25+
env:
26+
GO_VERSION: ${{ steps.go-version.outputs.stdout }}
27+
run: |
28+
sed -i -e "s|(go\s)(([0-9]+\.?){2}([0-9]+)?)|go\ $GO_VERSION|g" go.mod
29+
- name: "Setup Go"
30+
uses: actions/setup-go@v5
31+
with:
32+
go-version: ${{ steps.go-version.outputs.stdout }}
33+
- name: "Update dependencies"
34+
run: |
35+
length=$(yq -r '.dependencies | length' .versions.yaml)
36+
if [[ "$length" -eq 0 ]]; then
37+
printf "No dependencies to update\n"
38+
exit 1
39+
fi
40+
41+
deps=$(yq -r '.dependencies | keys | .[]' .versions.yaml)
42+
for dep in $deps; do
43+
version=$(dependency="$dep" yq -r '.dependencies[env(dependency)]' .versions.yaml)
44+
printf "Updating %s to %s\n" "$dep" "$version"
45+
go get -u "github.com/conductorone/$dep@$version"
46+
done
47+
- name: "go mod tidy && go mod vendor"
48+
run: |
49+
go mod tidy && go mod vendor
50+
- name: "Verify build"
51+
run: |
52+
go build ./...
53+
- name: "Commit changes"
54+
uses: EndBug/add-and-commit@v9
55+
with:
56+
default_author: github_actions
57+
message: "chore: update dependency & Go versions"
58+
add: |
59+
go.mod
60+
go.sum
61+
vendor/

0 commit comments

Comments
 (0)