Skip to content

Commit 6d786ea

Browse files
committed
Add release-ad-hoc.yml to the 1.1.x branch
1 parent 2795c5b commit 6d786ea

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

.github/workflows/release-ad-hoc.yml

+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Ad Hoc Release (1.1.x)
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
GCHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}
8+
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
9+
COMMIT_OWNER: ${{ github.event.pusher.name }}
10+
COMMIT_SHA: ${{ github.sha }}
11+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
12+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
13+
14+
jobs:
15+
prerequisites:
16+
name: Pre-requisites for building
17+
runs-on: ubuntu-latest
18+
if: github.repository == 'spring-projects/spring-pulsar'
19+
outputs:
20+
runjobs: ${{ steps.continue.outputs.runjobs }}
21+
project_version: ${{ steps.continue.outputs.project_version }}
22+
boot_version: ${{ steps.continue.outputs.boot_version }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- id: continue
26+
name: Determine if should continue
27+
run: |
28+
# Run jobs if in upstream repository
29+
echo "runjobs=true" >>$GITHUB_OUTPUT
30+
# Extract version from gradle.properties
31+
version=$(cat gradle.properties | grep "version=" | awk -F'=' '{print $2}')
32+
echo "project_version=$version" >>$GITHUB_OUTPUT
33+
bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2)
34+
echo "boot_version=$bootVersion" >>$GITHUB_OUTPUT
35+
perform_release:
36+
name: Perform Release
37+
needs: [prerequisites]
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: write
41+
timeout-minutes: 120
42+
if: ${{ !endsWith(needs.prerequisites.outputs.project_version, '-SNAPSHOT') }}
43+
env:
44+
REPO: ${{ github.repository }}
45+
BRANCH: ${{ github.ref_name }}
46+
VERSION: ${{ needs.prerequisites.outputs.project_version }}
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
51+
- uses: spring-io/spring-gradle-build-action@v2
52+
- name: Wait for Artifactory artifacts (milestone)
53+
if: ${{ contains(needs.prerequisites.outputs.project_version, '-RC') || contains(needs.prerequisites.outputs.project_version, '-M') }}
54+
run: |
55+
echo "Wait for artifacts of $REPO@$VERSION to appear on Artifactory."
56+
until curl -f -s https://repo.spring.io/artifactory/milestone/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null
57+
do
58+
sleep 30
59+
echo "."
60+
done
61+
echo "Artifacts for $REPO@$VERSION have been released to Artifactory."
62+
- name: Wait for Maven Central artifacts (GA)
63+
if: ${{ !contains(needs.prerequisites.outputs.project_version, '-SNAPSHOT') && !contains(needs.prerequisites.outputs.project_version, '-RC') && !contains(needs.prerequisites.outputs.project_version, '-M') }}
64+
run: |
65+
echo "Wait for artifacts of $REPO@$VERSION to appear on Maven Central."
66+
until curl -f -s https://repo1.maven.org/maven2/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null
67+
do
68+
sleep 30
69+
echo "."
70+
done
71+
echo "Artifacts for $REPO@$VERSION have been released to Maven Central."
72+
- name: Setup git for release tagging
73+
run: |
74+
git config user.name 'github-actions[bot]'
75+
git config user.email 'github-actions[bot]@users.noreply.github.com'
76+
- name: Tag release
77+
run: |
78+
echo "Tagging $REPO@$VERSION release."
79+
git tag v$VERSION
80+
git push --tags origin
81+
- name: Install tooling for Github release
82+
run: |
83+
curl -sSL -O https://github.com/spring-io/github-changelog-generator/releases/download/v0.0.10/github-changelog-generator.jar
84+
- name: Create Github release
85+
env:
86+
RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5
87+
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
88+
run: |
89+
java -jar github-changelog-generator.jar \
90+
--spring.config.location=.github/changelog-generator.yml \
91+
$VERSION $RELEASE_NOTES_FILE
92+
cat $RELEASE_NOTES_FILE
93+
gh release create v$VERSION \
94+
--draft \
95+
--title "Spring Pulsar $VERSION" \
96+
--generate-notes \
97+
--notes-file $RELEASE_NOTES_FILE
98+
- name: Announce Release in Chat
99+
uses: julb/action-post-googlechat-message@v1
100+
if: env.GCHAT_WEBHOOK_URL
101+
with:
102+
message: "spring-pulsar-announcing `${{ env.VERSION }}`"
103+
gchat_webhook_url: ${{ env.GCHAT_WEBHOOK_URL }}
104+
- name: Update next snapshot version
105+
run: |
106+
echo "Updating $REPO@$VERSION to next snapshot version."
107+
./gradlew :updateToSnapshotVersion
108+
git commit -am "[Release $VERSION] Next development version"
109+
git push

0 commit comments

Comments
 (0)