Skip to content

Commit

Permalink
refactor: change publish script3
Browse files Browse the repository at this point in the history
  • Loading branch information
Boy0000 committed Jan 25, 2024
1 parent 5741424 commit 90ac757
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
36 changes: 30 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '(?!<latest>)[\d\.]*(?=</latest>)' \
)" >> $GITHUB_ENV
- name: Run gradle build and publish
run: gradle build publish -PoraxenMavenUsername=${{ secrets.MAVEN_PUBLISH_USERNAME }} -PoraxenMavenPassword=${{ secrets.MAVEN_PUBLISH_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
6 changes: 3 additions & 3 deletions idofront-gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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?
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions idofront-gradle/src/main/kotlin/Publishing.kt
Original file line number Diff line number Diff line change
@@ -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?
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

publishing {
addMineInAbyssRepo(project)
addOraxenRepo(project)

// Conditional statement to support publishing on multiplatform
if (components.findByName("java") != null) {
Expand Down

0 comments on commit 90ac757

Please sign in to comment.