From 58269945206b82a8d34fc971338854f12fb1a6d1 Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Sun, 29 Sep 2024 22:52:46 +0530 Subject: [PATCH 1/7] add code to automate go patch version bump --- .../workflows/weekly-go-version-check.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/weekly-go-version-check.yaml diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml new file mode 100644 index 000000000000..2b018277f224 --- /dev/null +++ b/.github/workflows/weekly-go-version-check.yaml @@ -0,0 +1,39 @@ +name: Weekly go version check + + +on: + schedule: + # Cron for every week at 12:00 UTC. + - cron: "" + +permissions: {} + +jobs: + weekly-go-patch-version-check: + name: Check go patch version + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c + with: + files: | + ./*file | egrep -v "Dockerfile" + - name: Get latest go patch version + id: patch-version + run: | + export GO_PATCH_VERSION=$(curl --silent https://go.dev/VERSION?m=text) + sed -i 's/GO_VERSION=[0-9\.]*/GO_VERSION=$GO_PATCH_VERSION/' Makefile + sed -i 's/golang:[0-9\.]*/golang:$GO_PATCH_VERSION/' Tiltfile + - name: Create Pull Request + uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # tag=v7.0.5 + with: + commit-message: Bump to Go ${GO_PATCH_VERSION} + title: "Bump to Go patch version ${GO_PATCH_VERSION}" + body: | + This PR promotes current GO version to the latest patch version of ${GO_PATCH_VERSION} + branch: promote-go-patch-version-${{ GO_PATCH_VERSION }} + + From 38656a0cd1040d6c993df5964cafabced91afe55 Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Sun, 29 Sep 2024 22:54:33 +0530 Subject: [PATCH 2/7] update cron values --- .github/workflows/weekly-go-version-check.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index 2b018277f224..7e1aae3f187d 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -1,12 +1,13 @@ name: Weekly go version check - on: schedule: - # Cron for every week at 12:00 UTC. - - cron: "" + # Cron for every Mon at 12:00 UTC. + - cron: "0 12 * * 1" -permissions: {} +permissions: + contents: write + pull-requests: write jobs: weekly-go-patch-version-check: From 8282e6596e72cd54f8cebc972618d137e40e2a8f Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Sun, 3 Nov 2024 12:50:26 +0530 Subject: [PATCH 3/7] add workflow_dispatch --- .github/workflows/weekly-go-version-check.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index 7e1aae3f187d..72af06ba3eb6 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -1,6 +1,7 @@ name: Weekly go version check on: + workflow_dispatch: schedule: # Cron for every Mon at 12:00 UTC. - cron: "0 12 * * 1" @@ -12,6 +13,10 @@ permissions: jobs: weekly-go-patch-version-check: name: Check go patch version + strategy: + fail-fast: false + matrix: + branch: [automate-go-patching] runs-on: ubuntu-latest steps: - name: Checkout code From 6fe2f134229e53988708ec1fea1d58728b2e5fc7 Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Sun, 3 Nov 2024 13:13:23 +0530 Subject: [PATCH 4/7] add run for push, workflow_dispatch --- .github/workflows/weekly-go-version-check.yaml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index 72af06ba3eb6..3078c3424514 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -2,9 +2,13 @@ name: Weekly go version check on: workflow_dispatch: - schedule: - # Cron for every Mon at 12:00 UTC. - - cron: "0 12 * * 1" + push: + branches: + - automate-go-patching + + # schedule: + # # Cron for every Mon at 12:00 UTC. + # - cron: "0 12 * * 1" permissions: contents: write From a1d6a5cf9beac11bf613df193370bd7bb21abd74 Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Sun, 3 Nov 2024 17:33:50 +0530 Subject: [PATCH 5/7] update env value --- .../workflows/weekly-go-version-check.yaml | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index 3078c3424514..b553939d11d0 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -5,10 +5,9 @@ on: push: branches: - automate-go-patching - - # schedule: - # # Cron for every Mon at 12:00 UTC. - # - cron: "0 12 * * 1" + schedule: + # Cron for every Mon at 12:00 UTC. + - cron: "0 12 * * 1" permissions: contents: write @@ -34,16 +33,15 @@ jobs: - name: Get latest go patch version id: patch-version run: | - export GO_PATCH_VERSION=$(curl --silent https://go.dev/VERSION?m=text) - sed -i 's/GO_VERSION=[0-9\.]*/GO_VERSION=$GO_PATCH_VERSION/' Makefile - sed -i 's/golang:[0-9\.]*/golang:$GO_PATCH_VERSION/' Tiltfile + echo "GO_PATCH_VERSION=$(curl --silent https://go.dev/VERSION?m=text | sed -n 's/^go\([0-9.]*\).*/\1/p')" >> $GITHUB_ENV + pwd + sed -i 's/GO_VERSION=[0-9\.]*/GO_VERSION=${{ env.GO_PATCH_VERSION }}/' Makefile + sed -i 's/golang:[0-9\.]*/golang:${{ env.GO_PATCH_VERSION }}/' Tiltfile - name: Create Pull Request uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # tag=v7.0.5 with: - commit-message: Bump to Go ${GO_PATCH_VERSION} - title: "Bump to Go patch version ${GO_PATCH_VERSION}" + commit-message: Bump to Go ${{ env.GO_PATCH_VERSION }} + title: "Bump to Go patch version ${{ env.GO_PATCH_VERSION }}" body: | This PR promotes current GO version to the latest patch version of ${GO_PATCH_VERSION} - branch: promote-go-patch-version-${{ GO_PATCH_VERSION }} - - + branch: promote-go-patch-version-${{ env.GO_PATCH_VERSION }} From 7b500d276e5625036f84dba274a9fa928b84ed8b Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Mon, 4 Nov 2024 23:25:51 +0530 Subject: [PATCH 6/7] update makefile replace sed --- .github/workflows/weekly-go-version-check.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index b553939d11d0..7495dce445d5 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -35,8 +35,10 @@ jobs: run: | echo "GO_PATCH_VERSION=$(curl --silent https://go.dev/VERSION?m=text | sed -n 's/^go\([0-9.]*\).*/\1/p')" >> $GITHUB_ENV pwd - sed -i 's/GO_VERSION=[0-9\.]*/GO_VERSION=${{ env.GO_PATCH_VERSION }}/' Makefile - sed -i 's/golang:[0-9\.]*/golang:${{ env.GO_PATCH_VERSION }}/' Tiltfile + - name: Replace go_patch_version in Makefile + run: sed -i 's/GO_VERSION ?= [0-9\.]*/GO_VERSION ?= ${{ env.GO_PATCH_VERSION }}/' Makefile + - name: Replace go_patch_version in Tiltfile + run: sed -i 's/golang:[0-9\.]*/golang:${{ env.GO_PATCH_VERSION }}/' Tiltfile - name: Create Pull Request uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # tag=v7.0.5 with: From ad2e6cca197407db6640a659ee7aa77cb3e8ac10 Mon Sep 17 00:00:00 2001 From: Pravar Agrawal Date: Mon, 4 Nov 2024 23:42:25 +0530 Subject: [PATCH 7/7] update with weekly cron value only & main branch --- .github/workflows/weekly-go-version-check.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/weekly-go-version-check.yaml b/.github/workflows/weekly-go-version-check.yaml index 7495dce445d5..2d3ea53443c8 100644 --- a/.github/workflows/weekly-go-version-check.yaml +++ b/.github/workflows/weekly-go-version-check.yaml @@ -1,10 +1,10 @@ name: Weekly go version check on: - workflow_dispatch: - push: - branches: - - automate-go-patching + # workflow_dispatch: + # push: + # branches: + # - automate-go-patching schedule: # Cron for every Mon at 12:00 UTC. - cron: "0 12 * * 1" @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: false matrix: - branch: [automate-go-patching] + branch: [main] runs-on: ubuntu-latest steps: - name: Checkout code @@ -34,7 +34,6 @@ jobs: id: patch-version run: | echo "GO_PATCH_VERSION=$(curl --silent https://go.dev/VERSION?m=text | sed -n 's/^go\([0-9.]*\).*/\1/p')" >> $GITHUB_ENV - pwd - name: Replace go_patch_version in Makefile run: sed -i 's/GO_VERSION ?= [0-9\.]*/GO_VERSION ?= ${{ env.GO_PATCH_VERSION }}/' Makefile - name: Replace go_patch_version in Tiltfile @@ -45,5 +44,5 @@ jobs: commit-message: Bump to Go ${{ env.GO_PATCH_VERSION }} title: "Bump to Go patch version ${{ env.GO_PATCH_VERSION }}" body: | - This PR promotes current GO version to the latest patch version of ${GO_PATCH_VERSION} + This PR promotes current GO version to the latest patch version of ${{ env.GO_PATCH_VERSION }} branch: promote-go-patch-version-${{ env.GO_PATCH_VERSION }}