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