-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2a77b8
commit a6714cd
Showing
1 changed file
with
82 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Automate Release Creation | ||
|
||
env: | ||
WORKING_DIR: ./jvm-spring-web | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_type: | ||
description: 'Type of version bump (major/minor/patch)' | ||
required: false | ||
|
||
jobs: | ||
determine_next_version: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Determine Next Version | ||
id: determine_version | ||
run: | | ||
# Use the provided version type input for the bump, default to 'patch' if not provided | ||
VERSION_TYPE="${{ github.event.inputs.version_type || 'patch' }}" | ||
# Determine the next version | ||
CURRENT_VERSION=$(./gradlew -q printVersion) | ||
./gradlew bumpVersion -Ptype=$VERSION_TYPE | ||
NEW_VERSION=$(./gradlew -q printVersion) | ||
echo "::set-output name=new_version::$NEW_VERSION" | ||
working-directory: ${{ env.WORKING_DIR }} | ||
|
||
create_release_branch: | ||
runs-on: ubuntu-latest | ||
needs: determine_next_version | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Create and Push Release Branch | ||
run: | | ||
RELEASE_BRANCH="release/v${{ needs.determine_next_version.outputs.new_version }}" | ||
git checkout -b $RELEASE_BRANCH | ||
git push origin $RELEASE_BRANCH | ||
build_and_release: | ||
runs-on: ubuntu-latest | ||
needs: create_release_branch | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.create_release_branch.outputs.RELEASE_BRANCH }} | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Create GitHub Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ needs.determine_next_version.outputs.new_version }} | ||
name: Release ${{ needs.determine_next_version.outputs.new_version }} | ||
body: | | ||
Automated release for version ${{ needs.determine_next_version.outputs.new_version }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |