Skip to content

Commit

Permalink
added publishing to repsy maven
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Apr 2, 2024
1 parent 229e8af commit 42e730f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Artifacts
on:
workflow_dispatch:
jobs:
release:
strategy:
matrix:
# Use these Java versions
java: [17]
# and run on both Linux and Windows
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Antimatter
uses: actions/checkout@v2
with:
submodules: recursive
- name: Fetch tags
run: git fetch --tags
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Make Gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build & Publish
run: ./gradlew build publish --stacktrace
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GITHUB_RELEASE: true
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: build/libs/
19 changes: 14 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group

def isCI = System.getenv("GITHUB_ACTION")
def isRELEASE = System.getenv("GITHUB_RELEASE")

repositories {
maven { url = "https://mvn.devos.one/snapshots/" }
maven {
Expand Down Expand Up @@ -64,11 +67,17 @@ publishing {
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
if (isCI && isRELEASE) {
maven {
url = "https://repo.repsy.io/mvn/trinsdar/trins-mods/"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
} else {
mavenLocal()
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ loader_version=0.14.6

# Mod Properties
mod_version = 1.0.1
maven_group = trinsdar
maven_group = io.github.trinsdar
archives_base_name = ct-fabric-fluid-support

# Dependencies
Expand Down

0 comments on commit 42e730f

Please sign in to comment.