diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce21dc5..4d5c7a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,9 +10,9 @@ name: Java CI with Maven on: push: - branches: [ "master" ] + branches: [ "main" ] pull_request: - branches: [ "master" ] + branches: [ "main" ] jobs: build: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de9e6bd..d0c4720 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,10 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created -# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path +# This workflow will build a package using Maven and then publish it to maven central name: Publish Maven Package on: release: - types: [created] + types: [ created ] jobs: build: @@ -22,13 +21,15 @@ jobs: with: java-version: '17' distribution: 'temurin' - server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + server-id: central # Value of the distributionManagement/repository/id field of the pom.xml + server-username: OSSRH_USERNAME + server-password: OSSRH_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} settings-path: ${{ github.workspace }} # location for the settings.xml file - - name: Build with Maven - run: mvn -B package --file pom.xml - - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + - name: Publish to Maven Central + run: mvn --no-transfer-progress --batch-mode deploy -s $GITHUB_WORKSPACE/settings.xml # Change to deploy when ready env: - GITHUB_TOKEN: ${{ github.token }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} \ No newline at end of file diff --git a/leveldb-api/pom.xml b/leveldb-api/pom.xml index 4fb2e5f..9086229 100644 --- a/leveldb-api/pom.xml +++ b/leveldb-api/pom.xml @@ -5,7 +5,7 @@ com.hivemc.leveldb leveldb-project - 1.0.0-SNAPSHOT + 1.0.1 leveldb-api diff --git a/leveldb-benchmark/pom.xml b/leveldb-benchmark/pom.xml index a9e8fc9..94b77e1 100644 --- a/leveldb-benchmark/pom.xml +++ b/leveldb-benchmark/pom.xml @@ -21,7 +21,7 @@ com.hivemc.leveldb leveldb-project - 1.0.0-SNAPSHOT + 1.0.1 leveldb-benchmark diff --git a/leveldb/dependency-reduced-pom.xml b/leveldb/dependency-reduced-pom.xml index 969c085..0ef5024 100644 --- a/leveldb/dependency-reduced-pom.xml +++ b/leveldb/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ leveldb-project com.hivemc.leveldb - 1.0.0-SNAPSHOT + 1.0.1 4.0.0 leveldb diff --git a/leveldb/pom.xml b/leveldb/pom.xml index 445d00e..6a08df1 100644 --- a/leveldb/pom.xml +++ b/leveldb/pom.xml @@ -5,7 +5,7 @@ com.hivemc.leveldb leveldb-project - 1.0.0-SNAPSHOT + 1.0.1 leveldb diff --git a/leveldb/src/main/java/org/iq80/leveldb/fileenv/FileLock.java b/leveldb/src/main/java/org/iq80/leveldb/fileenv/FileLock.java index 1cdb2f0..af57f5f 100644 --- a/leveldb/src/main/java/org/iq80/leveldb/fileenv/FileLock.java +++ b/leveldb/src/main/java/org/iq80/leveldb/fileenv/FileLock.java @@ -82,6 +82,9 @@ public void release() catch (IOException e) { throw new DBException(e); } + finally { + lockFile.delete(); + } } @Override diff --git a/leveldb/src/test/java/org/iq80/leveldb/fileenv/FileLockTest.java b/leveldb/src/test/java/org/iq80/leveldb/fileenv/FileLockTest.java index 5be173b..0731517 100644 --- a/leveldb/src/test/java/org/iq80/leveldb/fileenv/FileLockTest.java +++ b/leveldb/src/test/java/org/iq80/leveldb/fileenv/FileLockTest.java @@ -29,13 +29,13 @@ public class FileLockTest { @Test - public void testCanDeleteFileAfterUnlock() throws IOException + public void testNoLockAfterUnlock() throws IOException { File databaseDir = FileUtils.createTempDir("leveldb"); File lock1 = new File(databaseDir, "LOCK"); FileLock lock = FileLock.tryLock(lock1); lock.release(); - assertTrue(lock1.delete()); + assertFalse(lock1.exists()); assertTrue(databaseDir.delete()); assertFalse(databaseDir.exists()); } @@ -57,7 +57,7 @@ public void testCantDoubleLock() throws IOException } @Test - public void testCanDeleteFileAfterLockFailure() throws IOException + public void testNoLockAfterLockFailure() throws IOException { File databaseDir = FileUtils.createTempDir("leveldb"); File lock1 = new File(databaseDir, "LOCK"); @@ -70,7 +70,7 @@ public void testCanDeleteFileAfterLockFailure() throws IOException //expected } lock.release(); - assertTrue(lock1.delete()); + assertFalse(lock1.exists()); assertTrue(databaseDir.delete()); assertFalse(databaseDir.exists()); } diff --git a/pom.xml b/pom.xml index 6724367..c7389d2 100644 --- a/pom.xml +++ b/pom.xml @@ -11,11 +11,11 @@ com.hivemc.leveldb leveldb-project - 1.0.0-SNAPSHOT + 1.0.1 pom ${project.groupId}:${project.artifactId} - Port of LevelDB to Java + Port of LevelDB to Java compatible with MCPE https://github.com/HiveGamesOSS/leveldb-mcpe-java @@ -96,16 +96,6 @@ - - - chunker-dev - https://pkgs.dev.azure.com/hivetooling/Chunker/_packaging/chunker/maven/v1 - - - chunker-dev - https://pkgs.dev.azure.com/hivetooling/Chunker/_packaging/chunker/maven/v1 - - @@ -121,6 +111,65 @@ ${converallstoken} + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + package + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.8.0 + + + attach-javadocs + package + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.4 + + + sign-artifacts + verify + + sign + + + + + + + --pinentry-mode + loopback + + + + + org.sonatype.central + central-publishing-maven-plugin + 0.5.0 + true + + central + + - + \ No newline at end of file