vitess.io/vitess@v0.16.2/.github/workflows/update_golang_version.yml (about) 1 name: Update Golang Version 2 3 on: 4 schedule: 5 - cron: "0 0 * * *" # Runs every day at midnight UTC 6 workflow_dispatch: 7 8 jobs: 9 update_golang_version: 10 strategy: 11 matrix: 12 branch: [ main, release-16.0, release-15.0, release-14.0 ] 13 name: Update Golang Version 14 runs-on: ubuntu-latest 15 steps: 16 - name: Set up Go 17 uses: actions/setup-go@v2 18 with: 19 go-version: 1.20.3 20 21 - name: Check out code 22 uses: actions/checkout@v3 23 with: 24 ref: ${{ matrix.branch }} 25 26 - name: Detect new version and update codebase 27 id: detect-and-update 28 run: | 29 old_go_version=$(go run ./go/tools/go-upgrade/go-upgrade.go get go-version) 30 echo "old-go-version=${old_go_version}" >> $GITHUB_OUTPUT 31 32 if [ ${{ matrix.branch }} == "main" ]; then 33 go run ./go/tools/go-upgrade/go-upgrade.go upgrade --workflow-update=false --main --allow-major-upgrade 34 else 35 go run ./go/tools/go-upgrade/go-upgrade.go upgrade --workflow-update=false 36 fi 37 38 output=$(git status -s) 39 if [ -z "${output}" ]; then 40 exit 0 41 fi 42 43 go_version=$(go run ./go/tools/go-upgrade/go-upgrade.go get go-version) 44 bootstrap_version=$(go run ./go/tools/go-upgrade/go-upgrade.go get bootstrap-version) 45 echo "go-version=${go_version}" >> $GITHUB_OUTPUT 46 echo "bootstrap-version=${bootstrap_version}" >> $GITHUB_OUTPUT 47 48 # Check if the PR already exists, if it does then do not create new PR. 49 gh pr list -S "is:open [${{ matrix.branch }}] Upgrade the Golang version to go${go_version}" | grep "OPEN" 50 if [ $? -eq 0 ]; then 51 exit 0 52 fi 53 54 echo "create-pr=true" >> $GITHUB_OUTPUT 55 56 - name: Create Pull Request 57 if: steps.detect-and-update.outputs.create-pr == 'true' 58 uses: peter-evans/create-pull-request@v4 59 with: 60 branch: "upgrade-go-to-${{steps.detect-and-update.outputs.go-version}}-on-${{ matrix.branch }}" 61 commit-message: "bump go version to go${{steps.detect-and-update.outputs.go-version}}" 62 signoff: true 63 delete-branch: true 64 title: "[${{ matrix.branch }}] Upgrade the Golang version to `go${{steps.detect-and-update.outputs.go-version}}`" 65 body: | 66 This Pull Request bumps the Golang version to `go${{steps.detect-and-update.outputs.go-version}}` and the bootstrap version to `${{steps.detect-and-update.outputs.bootstrap-version}}`. 67 68 > Do not trust the bot blindly. A thorough code review must be done to ensure all the files have been correctly modified. 69 70 There are a few manual steps remaining: 71 - [ ] Make sure you update the Golang version used in the previous and next release branches for the Upgrade/Downgrade tests. 72 - [ ] Build and Push the bootstrap images to Docker Hub, the bot cannot handle that. 73 - [ ] Update the `./.github/workflows/*.yml` files with the newer Golang version, the bot cannot handle that due to permissions. 74 - To accomplish this, run the following: `go run ./go/tools/go-upgrade/go-upgrade.go upgrade workflows --go-to=${{steps.detect-and-update.outputs.go-version}}` 75 base: ${{ matrix.branch }} 76 labels: | 77 Skip CI 78 go 79 Benchmark me 80 Component: General 81 Type: CI/Build