|
8 | 8 | tags: ["v*"] |
9 | 9 |
|
10 | 10 | permissions: |
11 | | - contents: read |
| 11 | + contents: write |
| 12 | + pull-requests: write |
12 | 13 |
|
13 | 14 | jobs: |
14 | 15 | publish: |
|
63 | 64 | PGP_SECRET: ${{ secrets.PGP_SECRET }} |
64 | 65 | SONATYPE_USERNAME: ${{ secrets.KALIX_IO_SONATYPE_USER }} |
65 | 66 | 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 |
0 commit comments