Skip to content

Commit

Permalink
Auto java release
Browse files Browse the repository at this point in the history
  • Loading branch information
LuQQiu committed Sep 4, 2024
1 parent bc71741 commit d6fd5b5
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 18 deletions.
72 changes: 54 additions & 18 deletions .github/workflows/bump-version/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,61 @@ name: Bump version for releases
description: "Call bumpversion"
inputs:
part:
description: 'What kind of release is this?'
description: "What kind of release is this?"
required: true
default: 'release'
default: "release"
runs:
using: "composite"
steps:
- name: Set git configs for bumpversion
shell: bash
run: |
git config user.name 'Lance Release'
git config user.email '[email protected]'
- name: Create release version and tags
working-directory: python
shell: bash
run: |
cargo install cargo-bump
cargo bump ${{ inputs.part }}
- name: Synchronize rust version
shell: bash
run: |
cargo install cargo-workspaces --version 0.2.44
cargo ws version --no-git-commit -y --exact --force 'lance*' ${{ inputs.part }}
- name: Set git configs for bumpversion
shell: bash
run: |
git config user.name 'Lance Release'
git config user.email '[email protected]'
- name: Create release version and tags
working-directory: python
shell: bash
run: |
cargo install cargo-bump
cargo bump ${{ inputs.part }}
- name: Synchronize rust version
shell: bash
run: |
cargo install cargo-workspaces --version 0.2.44
cargo ws version --no-git-commit -y --exact --force 'lance*' ${{ inputs.part }}
- name: Bump java version
working-directory: java
shell: bash
run: |
# Get current version
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
current_version=${current_version%\%}
# Split the version into components using parameter expansion
major=${current_version%%.*}
minor=${current_version#*.}
minor=${minor%%.*}
patch=${current_version##*.}
case "${{ inputs.part }}" in
patch)
patch=$((patch + 1))
;;
minor)
minor=$((minor + 1))
patch=0
;;
major)
major=$((major + 1))
minor=0
patch=0
;;
*)
echo "Invalid part specified"
exit 1
;;
esac
new_version="${major}.${minor}.${patch}"
mvn versions:set versions:commit -DnewVersion=$new_version
7 changes: 7 additions & 0 deletions .github/workflows/java-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Build and publish Java packages
on:
release:
# Use released instead of published, since we don't publish preview/beta
# versions
types: [released]
pull_request:
paths:
Expand Down Expand Up @@ -99,7 +101,12 @@ jobs:
run: |
git config --global user.email "Lance Github Runner"
git config --global user.name "[email protected]"
- name: Dry run
if: github.event_name == 'pull_request'
run: |
mvn --batch-mode -DskipTests package
- name: Publish with Java 8
if: github.event_name == 'release'
run: |
echo "use-agent" >> ~/.gnupg/gpg.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
Expand Down

0 comments on commit d6fd5b5

Please sign in to comment.