diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index aeb286e..54a1dae 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,10 +14,34 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: oraxen/publish-action@master + - name: Set up JDK + uses: actions/setup-java@v3 with: - maven-metadata-url: https://repo.oraxen.com/releases/com/mineinabyss/idofront-util/maven-metadata.xml - maven-username: ${{ secrets.MAVEN_USERNAME }} - maven-password: ${{ secrets.MAVEN_PASSWORD }} - release-files: | - ${{ github.workspace }}/publish/*.jar + distribution: temurin + java-version: 17 + + - name: Set env variable from latest maven version + run: > + echo "RELEASE_VERSION=$( \ + curl https://repo.oraxen.com/releases/com/mineinabyss/idofront-util/maven-metadata.xml | \ + grep -oP '(?!)[\d\.]*(?=)' \ + )" >> $GITHUB_ENV + + - name: Run gradle build and publish + run: gradle build publish -PoraxenMavenUsername=${{ secrets.MAVEN_USERNAME }} -PoraxenMavenPassword=${{ secrets.MAVEN_PASSWORD }} + + - name: Get version from gradle + shell: bash + id: extract_version + run: | + version=`gradle properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}'` + echo "::set-output name=version::$version" + + - name: Create GitHub Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + automatic_release_tag: v${{ steps.extract_version.outputs.version }} + files: | + build/libs/*[0-9].jar diff --git a/idofront-gradle/build.gradle.kts b/idofront-gradle/build.gradle.kts index 4396212..9fe9cde 100644 --- a/idofront-gradle/build.gradle.kts +++ b/idofront-gradle/build.gradle.kts @@ -50,13 +50,13 @@ dependencies { publishing { repositories { maven { - val repo = "https://repo.mineinabyss.com/" + val repo = "https://repo.oraxen.com/" val isSnapshot = System.getenv("IS_SNAPSHOT") == "true" val url = if (isSnapshot) repo + "snapshots" else repo + "releases" setUrl(url) credentials { - username = project.findProperty("mineinabyssMavenUsername") as String? - password = project.findProperty("mineinabyssMavenPassword") as String? + username = project.findProperty("oraxenMavenUsername") as String? + password = project.findProperty("oraxenMavenPassword") as String? } } } diff --git a/idofront-gradle/src/main/kotlin/Publishing.kt b/idofront-gradle/src/main/kotlin/Publishing.kt index d5cd5d5..c304d05 100644 --- a/idofront-gradle/src/main/kotlin/Publishing.kt +++ b/idofront-gradle/src/main/kotlin/Publishing.kt @@ -1,18 +1,18 @@ import org.gradle.api.Project import org.gradle.api.publish.PublishingExtension -fun PublishingExtension.addMineInAbyssRepo( +fun PublishingExtension.addOraxenRepo( project: Project, ) { repositories { maven { - val repo = "https://repo.mineinabyss.com/" + val repo = "https://repo.oraxen.com/" val isSnapshot = System.getenv("IS_SNAPSHOT") == "true" val url = if (isSnapshot) repo + "snapshots" else repo + "releases" setUrl(url) credentials { - username = project.findProperty("mineinabyssMavenUsername") as String? - password = project.findProperty("mineinabyssMavenPassword") as String? + username = project.findProperty("oraxenMavenUsername") as String? + password = project.findProperty("oraxenMavenPassword") as String? } } } diff --git a/idofront-gradle/src/main/kotlin/com.mineinabyss.conventions.publication.gradle.kts b/idofront-gradle/src/main/kotlin/com.mineinabyss.conventions.publication.gradle.kts index e090b6f..dd1f40e 100644 --- a/idofront-gradle/src/main/kotlin/com.mineinabyss.conventions.publication.gradle.kts +++ b/idofront-gradle/src/main/kotlin/com.mineinabyss.conventions.publication.gradle.kts @@ -3,7 +3,7 @@ plugins { } publishing { - addMineInAbyssRepo(project) + addOraxenRepo(project) // Conditional statement to support publishing on multiplatform if (components.findByName("java") != null) {