mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-08 01:08:13 +01:00
Publish releases.
This commit is contained in:
parent
bd6fb4e51c
commit
009a94f74d
33
.github/workflows/build.yml
vendored
33
.github/workflows/build.yml
vendored
@ -1,33 +0,0 @@
|
||||
name: Maven CI/CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Build with Gradle
|
||||
run: gradlew build
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: Multiverse-Core-SNAPSHOT
|
||||
# Can use build\/libs\/Multiverse-Core-(\d\.\d\.\d)(-SNAPSHOT|).jar if it ever supports regex
|
||||
path: build/libs/**
|
||||
# If there's nothing there then something must have gone awry
|
||||
if-no-files-found: error
|
47
.github/workflows/publish.yml
vendored
Normal file
47
.github/workflows/publish.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
name: Publish package to GitHub Packages
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'adopt'
|
||||
cache: gradle
|
||||
|
||||
- name: Get release
|
||||
id: get_release
|
||||
uses: bruceadams/get-release@v1.3.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Validate Gradle wrapper
|
||||
uses: gradle/wrapper-validation-action@v1
|
||||
|
||||
- name: Publish package
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
arguments: publish
|
||||
env:
|
||||
GITHUB_VERSION: ${{ steps.get_release.outputs.tag }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload release artifact
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: build/libs/Multiverse-Core-${{ steps.get_release.outputs.tag }}.jar
|
||||
asset_name: Multiverse-Core-${{ steps.get_release.outputs.tag }}.jar
|
||||
asset_content_type: application/java-archive
|
30
build.gradle
30
build.gradle
@ -8,7 +8,7 @@ plugins {
|
||||
id 'org.jetbrains.intellij' version '1.1'
|
||||
}
|
||||
|
||||
version = '4.3.2-SNAPSHOT'
|
||||
version = System.getenv('GITHUB_VERSION')?.substring(1) ?: 'local'
|
||||
group = 'com.onarandombox.multiversecore'
|
||||
description = 'Multiverse-Core'
|
||||
|
||||
@ -85,15 +85,26 @@ tasks.withType(Javadoc) {
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
[apiElements, runtimeElements].each {
|
||||
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(jar) }
|
||||
it.outgoing.artifact(shadowJar)
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from(components.java)
|
||||
pom {
|
||||
ciManagement {
|
||||
system = 'jenkins'
|
||||
url = 'https://ci.onarandombox.com/'
|
||||
}
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = "https://maven.pkg.github.com/Multiverse/Multiverse-Core"
|
||||
credentials {
|
||||
username = System.getenv("GITHUB_ACTOR")
|
||||
password = System.getenv("GITHUB_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -115,11 +126,8 @@ compileJava {
|
||||
source = prepareSource.outputs
|
||||
}
|
||||
|
||||
|
||||
ext.buildNumber = System.getenv('BUILD_NUMBER') ?: 'UNKNOWN'
|
||||
|
||||
processResources {
|
||||
def props = [version: "${project.version}-b$buildNumber"]
|
||||
def props = [version: "${project.version}"]
|
||||
inputs.properties props
|
||||
filteringCharset 'UTF-8'
|
||||
filesMatching('plugin.yml') {
|
||||
|
Loading…
Reference in New Issue
Block a user