Skip to content

Commit 902fece

Browse files
Huzaif Mushtaq MirHuzaif Mushtaq Mir
authored andcommitted
ci: automate bump PR creation, slack notification
1 parent d358266 commit 902fece

File tree

2 files changed

+39
-16
lines changed

2 files changed

+39
-16
lines changed

.github/workflows/maven-publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,22 @@ jobs:
3434
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
3535
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} # Central Portal token
3636
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
37+
38+
- name: Extract version and create tag
39+
run: |
40+
VERSION=$(sed -n 's/^[[:space:]]*<version>\([^<]*\)<\/version>/\1/p' pom.xml | head -1)
41+
42+
[ -n "$VERSION" ] || exit 1
43+
44+
git tag "$VERSION" 2>/dev/null || echo "Tag already exists"
45+
git push origin "$VERSION" || true
46+
47+
- name: Notify slack releases channel
48+
uses: slackapi/slack-github-action@v2
49+
with:
50+
webhook: ${{ secrets.SLACK_RELEASES_PROD_WEBHOOK_URL }}
51+
webhook-type: webhook-trigger
52+
payload: |
53+
status: "${{ job.status }}"
54+
environment: "PRODUCTION"
55+
project: "LexFloatClient Java"

.github/workflows/update-version.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,28 @@ on:
1515
jobs:
1616
update-version:
1717
runs-on: ubuntu-latest
18+
env:
19+
LIBRARY_VERSION: ${{ github.event.inputs.libraryVersion }}
20+
PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }}
21+
1822
steps:
1923
- name: Checkout code
20-
uses: actions/checkout@v2
21-
22-
- name: Create new branch
23-
run: git checkout -b release/${{ github.event.inputs.packageVersion }}
24+
uses: actions/checkout@v4
2425

2526
- name: Update Version
2627
run: |
27-
sed -i '/VERSION=/!b;cVERSION=\"v${{ github.event.inputs.libraryVersion }}";' ./download-libs.sh
28-
sed -i '/<packaging>jar<\/packaging>/,/<name>/s/<version>[^<]*<\/version>/<version>${{ github.event.inputs.libraryVersion }}<\/version>/' pom.xml
29-
- name: Commit, Tag and Push
30-
run: |
31-
git add ./download-libs.sh
32-
git add pom.xml
33-
git config user.name github-actions
34-
git config user.email [email protected]
35-
git commit -m "chore(package version): updated version" | exit 0
36-
git tag ${{ github.event.inputs.packageVersion }}
37-
git push --set-upstream origin release/${{ github.event.inputs.packageVersion }}
38-
git push --tags
28+
sed -i -E 's/^([[:space:]]*)VERSION="[^"]*"/\1VERSION="v${{ env.LIBRARY_VERSION }}"/' ./download-libs.sh
29+
sed -i '/<packaging>jar<\/packaging>/,/<name>/s/<version>[^<]*<\/version>/<version>${{ env.LIBRARY_VERSION }}<\/version>/' pom.xml
30+
31+
- name: Create Pull Request
32+
uses: peter-evans/create-pull-request@v5
33+
with:
34+
branch: ci/${{ env.PACKAGE_VERSION }}
35+
title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}"
36+
commit-message: "chore(package version): updated version"
37+
body: |
38+
Automated package version bump.
39+
base: master
40+
add-paths: |
41+
./download-libs.sh
42+
pom.xml

0 commit comments

Comments
 (0)