mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-09 15:25:56 -04:00
update GitHub Actions, add Modrinth uploads
This commit is contained in:
parent
babd9ae917
commit
8000ef5f4e
@ -16,13 +16,16 @@ jobs:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: ${{ runner.os }}-gradle-
|
||||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@0d13054264b0bb894ded474f08ebb30921341cee
|
||||
with:
|
||||
arguments: build
|
||||
- name: Archive artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Release files
|
||||
path: build/libs/*.jar
|
||||
run: ./gradlew build
|
||||
env:
|
||||
GPR_USER: ${{ secrets.GPR_USER }}
|
||||
GPR_KEY: ${{ secrets.GPR_KEY }}
|
154
.github/workflows/publish.yml
vendored
Normal file
154
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
name: publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish-github:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Extract Version from Tag
|
||||
uses: rishabhgupta/split-by@v1
|
||||
id: split_tag
|
||||
with:
|
||||
string: ${{ github.event.release.tag_name }}
|
||||
split-by: '/'
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ubuntu-latest-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: ubuntu-latest-gradle-
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew -Pmod_version='${{ steps.split_tag.outputs._1 }}' build
|
||||
env:
|
||||
GPR_USER: ${{ secrets.GPR_USER }}
|
||||
GPR_KEY: ${{ secrets.GPR_KEY }}
|
||||
|
||||
- name: Add Artifacts to Github Release
|
||||
uses: alexellis/upload-assets@0.3.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
asset_paths: '["./build/libs/*.jar"]'
|
||||
|
||||
- name: Publish to Github Packages
|
||||
run: gradle -Pmod_version='${{ steps.split_tag.outputs._1 }}' publish
|
||||
env:
|
||||
GPR_USER: ${{ secrets.GPR_USER }}
|
||||
GPR_KEY: ${{ secrets.GPR_KEY }}
|
||||
GITHUB_MAVEN_URL: 'https://maven.pkg.github.com/${{ github.repository }}'
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
publish-curse:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Extract Version from Tag
|
||||
uses: rishabhgupta/split-by@v1
|
||||
id: split_tag
|
||||
with:
|
||||
string: ${{ github.event.release.tag_name }}
|
||||
split-by: '/'
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ubuntu-latest-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: ubuntu-latest-gradle-
|
||||
|
||||
# Set Curseforge release type based on pre-release flag.
|
||||
- name: Set release type to 'release'
|
||||
run: |
|
||||
echo "CURSEFORGE_RELEASE_TYPE=release" >> $GITHUB_ENV
|
||||
if: github.event.release.prerelease == false
|
||||
- name: Set release type to 'alpha'
|
||||
run: |
|
||||
echo "CURSEFORGE_RELEASE_TYPE=alpha" >> $GITHUB_ENV
|
||||
if: github.event.release.prerelease == true
|
||||
|
||||
- name: Publish to Curseforge
|
||||
run: ./gradlew -Pmod_version='${{ steps.split_tag.outputs._1 }}' curseforge
|
||||
env:
|
||||
GPR_USER: ${{ secrets.GPR_USER }}
|
||||
GPR_KEY: ${{ secrets.GPR_KEY }}
|
||||
CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }}
|
||||
CURSEFORGE_RELEASE_TYPE: ${{ env.CURSEFORGE_RELEASE_TYPE }}
|
||||
CHANGELOG: ${{ github.event.release.body }}
|
||||
|
||||
publish-modrinth:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Extract Version from Tag
|
||||
uses: rishabhgupta/split-by@v1
|
||||
id: split_tag
|
||||
with:
|
||||
string: ${{ github.event.release.tag_name }}
|
||||
split-by: '/'
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '8'
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ubuntu-latest-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: ubuntu-latest-gradle-
|
||||
|
||||
# Set Modrinth release type based on pre-release flag.
|
||||
- name: Set release type to 'release'
|
||||
run: |
|
||||
echo "MODRINTH_RELEASE_TYPE=release" >> $GITHUB_ENV
|
||||
if: github.event.release.prerelease == false
|
||||
- name: Set release type to 'alpha'
|
||||
run: |
|
||||
echo "MODRINTH_RELEASE_TYPE=alpha" >> $GITHUB_ENV
|
||||
if: github.event.release.prerelease == true
|
||||
|
||||
- name: Publish to Modrinth
|
||||
run: ./gradlew -Pmod_version='${{ steps.split_tag.outputs._1 }}' modrinth
|
||||
env:
|
||||
GPR_USER: ${{ secrets.GPR_USER }}
|
||||
GPR_KEY: ${{ secrets.GPR_KEY }}
|
||||
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
|
||||
MODRINTH_RELEASE_TYPE: ${{ env.MODRINTH_RELEASE_TYPE }}
|
||||
CHANGELOG: ${{ github.event.release.body }}
|
33
build.gradle
33
build.gradle
@ -19,7 +19,6 @@ buildscript {
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.7'
|
||||
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.4.0'
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,10 +26,11 @@ plugins {
|
||||
id 'scala'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id "com.matthewprenger.cursegradle" version "1.4.0"
|
||||
id 'com.modrinth.minotaur' version '2.2.0'
|
||||
}
|
||||
|
||||
apply plugin: 'forge'
|
||||
apply plugin: 'com.matthewprenger.cursegradle'
|
||||
|
||||
file "build.properties" withReader {
|
||||
def prop = new Properties()
|
||||
@ -268,6 +268,9 @@ artifacts {
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
groupId = project.group
|
||||
artifactId = project.name
|
||||
version = mod_version
|
||||
artifact jar
|
||||
artifact apiJar
|
||||
artifact javadocJar
|
||||
@ -277,26 +280,40 @@ publishing {
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url System.getenv("MAVEN_PATH")
|
||||
name = "GitHubPackages"
|
||||
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
curseforge {
|
||||
apiKey = project.hasProperty("curseForgeApiKey") ? project.curseForgeApiKey : ""
|
||||
apiKey = System.getenv('CURSEFORGE_API_KEY') ?: ""
|
||||
project {
|
||||
id = config.curse.project.id
|
||||
releaseType = config.curse.project.releaseType
|
||||
releaseType = System.getenv('CURSEFORGE_RELEASE_TYPE') ?: "alpha"
|
||||
changelogType = "markdown"
|
||||
changelog = file("changelog.md")
|
||||
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
|
||||
addGameVersion config.minecraft.version
|
||||
addGameVersion "Java 8"
|
||||
addGameVersion "Forge"
|
||||
|
||||
mainArtifact jar
|
||||
}
|
||||
}
|
||||
|
||||
modrinth {
|
||||
token = System.getenv("MODRINTH_API_KEY") ?: ""
|
||||
projectId = config.modrinth.project.id
|
||||
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
|
||||
versionNumber = mod_version
|
||||
versionName = "${rootProject.name}-${version}"
|
||||
versionType = System.getenv('MODRINTH_RELEASE_TYPE') ?: "alpha"
|
||||
uploadFile = jar
|
||||
gameVersions = [config.minecraft.version]
|
||||
}
|
||||
|
||||
// this is needed for IntelliJ so we don't have to copy over the assets manually every time
|
||||
idea {
|
||||
module {
|
||||
|
@ -50,4 +50,4 @@ cofhcore.cf=2388/750
|
||||
cofhcore.version=[1.7.10]3.1.4-329
|
||||
|
||||
curse.project.id=223008
|
||||
curse.project.releaseType=release
|
||||
modrinth.project.id=YiAbZis2
|
||||
|
@ -0,0 +1 @@
|
||||
mod_version=0.0.0
|
Loading…
x
Reference in New Issue
Block a user