Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
unidevel authored Feb 2, 2025
1 parent f646588 commit 41c1ff2
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ jobs:
distribution: 'temurin'
cache: gradle

- name: Set up gradle.properties
- name: Set up git
run: |
echo "skipSigning=false" >> gradle.properties
git config --global --add safe.directory ${{github.workspace}}
git config --global user.email "[email protected]"
git config --global user.name "prestodb-ci"
git config pull.rebase false
- name: Test Gradle Build
run: ./gradlew build
- name: Run gradle build
run: |
echo "skipSigning=false" > gradle.properties
./gradlew build
- name: Get latest release tag
id: get_latest_tag
Expand All @@ -47,6 +52,7 @@ jobs:
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0")
echo "Latest tag: $latest_tag"
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
echo "next_release_msg=Update build.gradle to next development version" >> $GITHUB_ENV
- name: Advance release version
id: advance_version
Expand All @@ -58,39 +64,34 @@ jobs:
# Increment the minor version
new_minor=$((minor + 1))
new_tag="$major.$new_minor"
echo "New tag: $new_tag"
echo "New release tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_ENV
dev_minor=$((minor + 2))
dev_tag="$major.$dev_minor-SNAPSHOT"
echo "New development tag: $dev_tag"
echo "dev_tag=$dev_tag" >> $GITHUB_ENV
- name: Generate CHANGELOG.md
id: generate_changelog
run: |
latest_tag=${{ env.latest_tag }}
# Get commits between the latest tag and HEAD, excluding changelog commits
changelog=$(git log $latest_tag..HEAD --oneline --pretty=format:"- %s" | grep -v "Update CHANGELOG.md and gradle.properties")
changelog=$(git log $latest_tag..HEAD --pretty=format:"- [%h](https://github.com/${{ github.repository }}/commit/%H) %s" | grep -v "${{ env.next_release_msg }}")
echo "Generating CHANGELOG.md"
echo -e "## Changelog for ${{ env.new_tag }}\n\n$changelog\n" > CHANGELOG.md
# Display the generated changelog
cat CHANGELOG.md
- name: Update release version in build.gradle
- name: Update release version and commit
run: |
# Update the version in build.gradle
sed -i "s/ext.tempto_version = '.*'/ext.tempto_version = '${{ env.new_tag }}'/" build.gradle
git add CHANGELOG.md build.gradle
git commit -m "Update CHANGELOG.md and build.gradle for version ${{ env.new_tag }}"
- name: Add release tag
run: |
# Configure git user
git config --global --add safe.directory ${{github.workspace}}
git config --global user.email "[email protected]"
git config --global user.name "prestodb-ci"
git config pull.rebase false
git tag -a ${{ env.new_tag }} -m "Release ${{ env.new_tag }}"
- name: Commit changes
run: |
git add CHANGELOG.md build.gradle
git commit -m "Update CHANGELOG.md and build.gradle for version ${{ env.new_tag }}"
- name: Set up GPG key
run: |
echo "${{ secrets.GPG_SECRET }}" > ${{ github.workspace }}/secret-key.gpg
Expand All @@ -112,6 +113,13 @@ jobs:
export NEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }}
./gradlew publish
- name: Update release version in build.gradle
run: |
# Update the version in build.gradle
sed -i "s/ext.tempto_version = '.*'/ext.tempto_version = '${{ env.dev_tag }}'/" build.gradle
git add build.gradle
git commit -m "${{ env.next_release_msg }}"
- name: Push changes and tags
run: |
git push origin master --tags

0 comments on commit 41c1ff2

Please sign in to comment.