-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Auto version bump and release (#490)
- Loading branch information
Showing
1 changed file
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,53 @@ | ||
name: Release new version | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
tag_name: | ||
description: 'Tag name to publish' | ||
required: true | ||
|
||
jobs: | ||
bump-version: | ||
runs-on: ubuntu-latest | ||
env: | ||
newVersion: ${{ github.event.inputs.tag_name }} | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Bump version in gradle.properties | ||
run: | | ||
newVersion=$(echo $newVersion | sed 's/^v//') | ||
sed -i.bak "s/^version=.*/version=$newVersion/" gradle.properties | ||
rm gradle.properties.bak | ||
- name: Setup git config | ||
run: | | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "<>" | ||
- name: Commit version bump | ||
run: | | ||
git add gradle.properties | ||
git commit -m "chore: Bump version to $newVersion" | ||
- name: Tag version | ||
run: | | ||
git tag $newVersion | ||
- name: Push changes | ||
run: | | ||
git push origin master | ||
# Push tag | ||
git push origin $newVersion | ||
build: | ||
needs: bump-version | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
branch: ${{ github.event.inputs.tag_name }} | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
|
@@ -20,7 +56,7 @@ jobs: | |
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.release.tag_name || github.event.inputs.tag_name}} | ||
ref: ${{ github.event.inputs.tag_name}} | ||
- name: Download uber-jar | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -36,6 +72,7 @@ jobs: | |
file: ${{ needs.build.outputs.uber-jar }} | ||
tags: true | ||
draft: false | ||
tag_name: ${{ github.event.inputs.tag_name }} | ||
- name: Deploy to Maven Central repository | ||
run: ./gradlew publish | ||
env: | ||
|