Skip to content

Commit d4fcf59

Browse files
fix: creating pr after publish (#2294)
1 parent 3e0899c commit d4fcf59

File tree

3 files changed

+73
-91
lines changed

3 files changed

+73
-91
lines changed

.github/workflows/fakepublish.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
tags: ["v*"]
99

1010
permissions:
11-
contents: read
11+
contents: write
12+
pull-requests: write
1213

1314
jobs:
1415
publish:
@@ -63,3 +64,74 @@ jobs:
6364
PGP_SECRET: ${{ secrets.PGP_SECRET }}
6465
SONATYPE_USERNAME: ${{ secrets.KALIX_IO_SONATYPE_USER }}
6566
SONATYPE_PASSWORD: ${{ secrets.KALIX_IO_SONATYPE_PASSWORD }}
67+
68+
validate-tag:
69+
name: Validate that tag is a release and not a snapshot or a milestone
70+
runs-on: ubuntu-22.04
71+
needs: publish
72+
outputs:
73+
release: ${{ steps.verification.outputs.release }}
74+
steps:
75+
76+
- name: Verify the tag is a release, not snapshot or milestone
77+
id: verification
78+
run: |
79+
TAG_NAME=${{ github.ref_name }}
80+
if [[ $TAG_NAME =~ ^v[0-9]+(\.[0-9]+){1,2}$ ]]; then
81+
echo "release=true" >> $GITHUB_OUTPUT
82+
else
83+
echo "Invalid version tag [$TAG_NAME]. Snapshots or milestones don't create PRs"
84+
fi
85+
shell: bash
86+
87+
create-pr:
88+
name: Create PR to update maven plugin and samples
89+
runs-on: ubuntu-22.04
90+
needs: validate-tag
91+
if: needs.validate-tag.outputs.release == 'true'
92+
steps:
93+
- name: Checkout
94+
# https://github.com/actions/checkout/releases
95+
# v4.1.1
96+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
97+
with:
98+
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
99+
fetch-depth: 0
100+
101+
- name: Cache Coursier cache
102+
# https://github.com/coursier/cache-action/releases
103+
# v6.4.5
104+
uses: coursier/cache-action@1ff273bff02a8787bc9f1877d347948af647956d
105+
106+
- name: Set up JDK 21
107+
# https://github.com/coursier/setup-action/releases
108+
# v1.3.5
109+
uses: coursier/setup-action@7bde40eee928896f074dbb76d22dd772eed5c65f
110+
with:
111+
jvm: temurin:1.21
112+
113+
- name: Determine SDK version
114+
id: determine_sdk_version
115+
run: |-
116+
.github/determine-sdk-version.sh
117+
SDK_VERSION="$(cat ~/kalix-sdk-version.txt)"
118+
echo "sdk_version=${SDK_VERSION}" >> $GITHUB_OUTPUT
119+
120+
- name: Create the PR
121+
env:
122+
SDK_VERSION: ${{ steps.determine_sdk_version.outputs.sdk_version }}
123+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
run: |-
125+
echo "Updating samples to version ${SDK_VERSION}"
126+
./updateSdkVersions.sh all
127+
BRANCH=bump-sdk-versions-${SDK_VERSION}
128+
git checkout -b ${BRANCH}
129+
git config user.name "Kalix Bot"
130+
git config user.email "[email protected]"
131+
git commit . -m "chore: bump SDK versions to ${SDK_VERSION}"
132+
git remote add origin-rw https://${GH_TOKEN}@github.com/lightbend/kalix-jvm-sdk
133+
git push --set-upstream origin-rw ${BRANCH}
134+
135+
gh pr create -B main -t "Auto PR - Bump SDK versions to ${SDK_VERSION}" \
136+
-b "This PR should update all existing samples (pom.xml and plugins.sbt) and the maven-java poms. Please review, and merge if okay." \
137+
-r ${{ github.actor }} || echo "No changes"; exit 0

.github/workflows/update-sdk-version.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)