Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test pr2 #20

Merged
merged 25 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions .github/workflows/build-jar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,44 @@ jobs:
distribution: 'adopt' # You can choose other distributions like 'zulu' or 'temurin'
java-version: '11'

- name: Pull branch
run: |
git checkout -b ${{ github.event.pull_request.head.ref }}
git pull origin ${{ github.event.pull_request.head.ref }} --rebase || echo "No changes to pull"

- name: Build and package JAR with dependencies
run: mvn clean package

- name: Move JAR to latest-version folder
run: |
mkdir -p latest-version
mv target/*-jar-with-dependencies.jar latest-version/mongodb-performance-test.jar

- name: Commit jar file to repository and add version tag
- name: commit changes of jar file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
mkdir -p latest-version

git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"
if ! cmp -s target/*-jar-with-dependencies.jar latest-version/mongodb-performance-test.jar; then

mv target/*-jar-with-dependencies.jar latest-version/mongodb-performance-test.jar
ls -al latest-version/

git add latest-version/mongodb-performance-test.jar
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)

# Check if there are staged changes
if git diff --staged --quiet; then
echo "### Build unchanged" >> $GITHUB_STEP_SUMMARY
echo "The [latest-version/mongodb-performance-test.jar](https://github.com/idealo/mongodb-performance-test/tree/master/latest-version/mongodb-performance-test.jar) is unchanged" >> $GITHUB_STEP_SUMMARY
else
git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"

git add latest-version/mongodb-performance-test.jar
git commit -m "Add latest version ($VERSION) of mongodb-performance-test.jar"
git push
git push origin ${{ github.event.pull_request.head.ref }}

# Delete the local tag if it exists
git tag -d "v$VERSION" || true # Ignore if the tag doesn't exist
git tag -a "v$VERSION" -m "Tagging version $VERSION"
git push origin :refs/tags/v$VERSION || true # delete remote tag, if exists
git push origin "v$VERSION" # create remote tag

echo "### Version updated to $VERSION" >> $GITHUB_STEP_SUMMARY
echo "The [latest-version/mongodb-performance-test.jar](https://github.com/idealo/mongodb-performance-test/tree/master/latest-version/mongodb-performance-test.jar) is now $VERSION" >> $GITHUB_STEP_SUMMARY
else
echo "### Build unchanged" >> $GITHUB_STEP_SUMMARY
echo "The [latest-version/mongodb-performance-test.jar](https://github.com/idealo/mongodb-performance-test/tree/master/latest-version/mongodb-performance-test.jar) is unchanged" >> $GITHUB_STEP_SUMMARY
fi

Binary file modified latest-version/mongodb-performance-test.jar
Binary file not shown.
24 changes: 0 additions & 24 deletions mongodb-performance-test.iml

This file was deleted.

1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@
<version>1.9.0</version>
</dependency>
</dependencies>

</project>