-
Notifications
You must be signed in to change notification settings - Fork 3
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
Showing
2 changed files
with
24 additions
and
14 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 |
---|---|---|
|
@@ -13,19 +13,21 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Java SDK | ||
uses: actions/setup-java@2 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: 'temurin' | ||
distribution: temurin | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.commit_hash }} | ||
|
||
- name: Check commit title and extract version | ||
env: | ||
COMMIT_HASH: ${{ github.event.inputs.commit_hash }} | ||
run: | | ||
export commit_title=$(git log --pretty=format:%s -1 ${{ github.event.inputs.commit_hash }}) | ||
export commit_title=$(git log --pretty=format:%s -1 $COMMIT_HASH | ||
echo "Commit title: $commit_title" | ||
if [[ $commit_title =~ ^Release\ version\ [0-9]*\.[0-9]*\.[0-9]*$ ]]; then | ||
echo "Valid commit title" | ||
|
@@ -42,11 +44,13 @@ jobs: | |
./gradlew clean build | ||
- name: Create tag | ||
env: | ||
VERSION: ${{ env.version }} | ||
run: | | ||
git config --local user.name "GitHub Action" | ||
git config --local user.email "[email protected]" | ||
git tag -a "v${{ env.version }}" -m "Release version ${{ env.version }}" | ||
git push origin "v${{ env.version }}" | ||
git tag -a "v$VERSION" -m "Release version $VERSION" | ||
git push origin "v$VERSION" | ||
- name: Create release draft | ||
id: create_release | ||
|
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 |
---|---|---|
|
@@ -16,38 +16,44 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check versions | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.release_version }} | ||
SNAPSHOT_VERSION: ${{ github.event.inputs.snapshot_version }} | ||
run: | | ||
echo "Checking release version..." | ||
if echo ${{ github.event.inputs.release_version }} | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+$' > /dev/null; then | ||
if echo $RELEASE_VERSION | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+$' > /dev/null; then | ||
echo "Release version is invalid" | ||
exit 1 | ||
fi | ||
echo "Checking snapshot version..." | ||
if echo ${{ github.event.inputs.snapshot_version }} | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT$' > /dev/null; then | ||
if echo $SNAPSHOT_VERSION | grep --invert-match '^[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT$' > /dev/null; then | ||
echo "Snapshot version is invalid" | ||
exit 1 | ||
fi | ||
- name: Checkout main | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
fetch-depth: 0 | ||
|
||
- name: Create release commits | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.release_version }} | ||
SNAPSHOT_VERSION: ${{ github.event.inputs.snapshot_version }} | ||
run: | | ||
git config --local user.name "GitHub Action" | ||
git config --local user.email "[email protected]" | ||
sed -i -e "s/^version=.\+$/version=${{ github.event.inputs.release_version }}/g" gradle.properties | ||
sed -i -e "s/^version=.\+$/version=$RELEASE_VERSION/g" gradle.properties | ||
git add gradle.properties | ||
git commit -m "Release version ${{ github.event.inputs.release_version }}" | ||
sed -i -e "s/^version=.\+$/version=${{ github.event.inputs.snapshot_version }}/g" gradle.properties | ||
git commit -m "Release version $RELEASE_VERSION" | ||
sed -i -e "s/^version=.\+$/version=$SNAPSHOT_VERSION/g" gradle.properties | ||
git add gradle.properties | ||
git commit -m "Bump version to ${{ github.event.inputs.snapshot_version }}" | ||
git commit -m "Bump version to $SNAPSHOT_VERSION" | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
branch: release-${{ github.event.inputs.release_version }} | ||
delete-branch: true | ||
|