Skip to content

Commit d76ab69

Browse files
fix release 1.29 github action (#1097)
1 parent 3f0606e commit d76ab69

File tree

4 files changed

+130
-4
lines changed

4 files changed

+130
-4
lines changed

.github/workflows/auto-sync-gh-pages.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Check Latest Release Tag
3232
id: check
3333
run: |
34-
git fetch --tags
34+
git fetch --tags --force
3535
3636
latest_tag=$(git tag --sort=-creatordate | head -n 1)
3737
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT

.github/workflows/bump-k8s-dep.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Bump latest Kubernetes dependecies
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 */2 * *' # Run every two days at UTC midnight
6+
7+
workflow_dispatch: # Use for manaully trigger to debug
8+
9+
jobs:
10+
bump-k8s-dep-to-latest-pre-release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'go.mod'
21+
22+
- name: Bump latest k8s.io dependencies
23+
id: bump
24+
run: |
25+
LATEST_VERSION=$(./hack/bump-k8s-dep.sh)
26+
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
27+
28+
- name: Configure Git
29+
run: |
30+
git config user.name "github-actions[bot]"
31+
git config user.email "[email protected]"
32+
33+
- name: Check for changes and update version
34+
id: changes
35+
run: |
36+
git_diff_output=$(git diff)
37+
if [ -n "$git_diff_output" ]; then
38+
echo "changes=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Check if update PR exist
42+
id: exist
43+
run: |
44+
LATEST_VERSION=${{ steps.bump.outputs.latest_version }}
45+
HEAD_BRANCH="topic/github-actions/auto-bump/k8s-dependencies-$LATEST_VERSION"
46+
echo "$HEAD_BRANCH"
47+
if ! git ls-remote --exit-code origin refs/heads/$HEAD_BRANCH; then
48+
echo "exist=true" >> $GITHUB_OUTPUT
49+
echo "head_branch=$HEAD_BRANCH" >> $GITHUB_OUTPUT
50+
fi
51+
52+
- name: Create PR
53+
if: ${{ steps.changes.outputs.changes && steps.exist.outputs.exist }}
54+
run: |
55+
HEAD_BRANCH=${{ steps.exist.outputs.head_branch }}
56+
git checkout -b "$HEAD_BRANCH"
57+
git add go.mod go.sum
58+
git commit -sm "Bump Kubernetes group dependencies updates"
59+
git push origin "$HEAD_BRANCH"
60+
gh pr create --base master --title ":seedling:(deps) Bump the Kubernetes group to ${{ steps.bump.outputs.latest_version }}" --label "ok-to-test" --body "This is an automatically generated pull request to bump the latest k8s dependencies."
61+
env:
62+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Bump latest Kubernetes dependecies for e2e test
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 */2 * *' # Run every two days at UTC noon
6+
7+
workflow_dispatch: # Use for manaully trigger to debug
8+
9+
jobs:
10+
bump-test-k8s-dep-to-latest-pre-release:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'test/e2e/go.mod'
21+
22+
- name: Bump latest k8s.io dependencies
23+
id: bump
24+
run: |
25+
cd test/e2e
26+
LATEST_VERSION=$(../../hack/bump-k8s-dep.sh test-e2e)
27+
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
28+
cd ../..
29+
30+
- name: Configure Git
31+
run: |
32+
git config user.name "github-actions[bot]"
33+
git config user.email "[email protected]"
34+
35+
- name: Check for changes and update version
36+
id: changes
37+
run: |
38+
git_diff_output=$(git diff)
39+
if [ -n "$git_diff_output" ]; then
40+
echo "changes=true" >> $GITHUB_OUTPUT
41+
fi
42+
43+
- name: Check if update PR already exist
44+
id: exist
45+
run: |
46+
LATEST_VERSION=${{ steps.bump.outputs.latest_version }}
47+
HEAD_BRANCH="topic/github-actions/auto-bump/test-e2e-k8s-dependencies-$LATEST_VERSION"
48+
echo "$HEAD_BRANCH"
49+
if ! git ls-remote --exit-code origin refs/heads/$HEAD_BRANCH; then
50+
echo "exist=true" >> $GITHUB_OUTPUT
51+
echo "head_branch=$HEAD_BRANCH" >> $GITHUB_OUTPUT
52+
fi
53+
54+
- name: Create PR
55+
if: ${{ steps.changes.outputs.changes && steps.exist.outputs.exist }}
56+
run: |
57+
HEAD_BRANCH=${{ steps.exist.outputs.head_branch }}
58+
git checkout -b "$HEAD_BRANCH"
59+
git add test/e2e/go.mod test/e2e/go.sum
60+
git commit -sm "Bump kubernetes group dependencies updates for e2e test"
61+
git push origin "$HEAD_BRANCH"
62+
gh pr create --base master --title ":seedling:(deps)test: Bump the kubernetes group to ${{ steps.bump.outputs.latest_version }} for e2e test" --label "ok-to-test" --body "This is an automatic generated pull request to bump the latest k8s dependencies for e2e test."
63+
env:
64+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/generate-release-notes.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- name: Check Latest Release Tag
3737
id: check
3838
run: |
39-
git fetch --tags
39+
git fetch --tags --force
4040
latest_tag=$(git tag --sort=-creatordate | head -n 1)
4141
4242
echo "latest_tag=${latest_tag}" >> $GITHUB_OUTPUT
@@ -52,11 +52,11 @@ jobs:
5252
5353
latest_tag=${{ steps.check.outputs.latest_tag }}
5454
if [[ latest_tag =~ ${PRERELEASE_SEMVER_REGEX} ]]; then
55-
second_latest_release_tag=$(git tag --sort=-v:refname | grep -E ${SEMVER_REGEX} | sed -n '2p')
55+
second_latest_release_tag=$(git tag --sort=-v:refname | grep -E ${SEMVER_REGEX} | awk 'p{print; exit} /${latest_tag}/{p=1}')
5656
echo "${latest_tag} is a pre-release, return second latest release tag ${second_latest_release_tag}"
5757
echo "pre_release=1" >> $GITHUB_OUTPUT
5858
else
59-
second_latest_release_tag=$(git tag --sort=-v:refname | grep -E ${STABLE_RELEASE_SEMVER_REGEX} | sed -n '2p')
59+
second_latest_release_tag=$(git tag --sort=-v:refname | grep -E ${STABLE_RELEASE_SEMVER_REGEX} | awk 'p{print; exit} /${latest_tag}/{p=1}')
6060
echo "${latest_tag} is a stable release, return second stable release tag ${second_latest_release_tag}"
6161
fi
6262

0 commit comments

Comments
 (0)