[Build] Add workflows for automatic releases
This commit is contained in:
1 parent
34e282e091
commit
1544682cc4
10 files changed
+190
-27
No files matched your search
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Build
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: build
|
||||
arguments: buildAll
|
||||
build-natives:
|
||||
env:
|
||||
FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
name: Publish to Maven
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
publish-modules:
|
||||
strategy:
|
||||
matrix:
|
||||
module: [imgui-app, imgui-lwjgl3, imgui-binding]
|
||||
name: Publish Module (${{ matrix.module }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
|
||||
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
|
||||
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
|
||||
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Java 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- name: Publish
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: ${{ format(':{0}:publishMavenJavaPublicationToMavenCentralRepository', matrix.module) }}
|
||||
|
||||
publish-natives:
|
||||
strategy:
|
||||
matrix:
|
||||
type: [win, linux, mac]
|
||||
freetype: [true, false]
|
||||
name: Publish Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }})
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
|
||||
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
|
||||
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
|
||||
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Java 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- name: Publish
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: ${{ format(':imgui-binding-natives:publishMavenJavaPublicationToMavenCentralRepository -PdeployType={0} -Pfreetype={1}', matrix.type, matrix.freetype) }}
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version'
|
||||
required: true
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Up Version
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: ${{ format('upVersion -Pnext={0}', github.event.inputs.version) }}
|
||||
|
||||
- name: Commit Version
|
||||
uses: EndBug/add-and-commit@v7
|
||||
with:
|
||||
default_author: github_actions
|
||||
message: ${{ format('v{0}', github.event.inputs.version) }}
|
||||
|
||||
- name: Push Tag
|
||||
uses: mathieudutour/github-tag-action@v5.5
|
||||
id: tag_version
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
custom_tag: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Build All
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: buildAll
|
||||
|
||||
- name: Generate changelog
|
||||
id: changelog
|
||||
uses: metcalfc/changelog-generator@v1.0.0
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
body: ${{ steps.tag_version.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
|
||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
files: |
|
||||
imgui-app/build/libs/*.jar
|
||||
imgui-binding/build/libs/*.jar
|
||||
imgui-lwjgl3/build/libs/*.jar
|
||||
bin/imgui-java64.dll
|
||||
bin/libimgui-java64.dylib
|
||||
bin/libimgui-java64.so
|
||||
@@ -1,3 +1,5 @@
|
||||
import tool.UpVersion
|
||||
|
||||
allprojects {
|
||||
group 'imgui-java'
|
||||
version property('version')
|
||||
@@ -5,3 +7,18 @@ allprojects {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('upVersion', UpVersion)
|
||||
|
||||
tasks.register('buildAll') { t ->
|
||||
t.group = 'build'
|
||||
t.description = 'Build all project sources.'
|
||||
|
||||
t.dependsOn ':imgui-app:shadowJar'
|
||||
|
||||
['app', 'binding', 'lwjgl3'].each { module ->
|
||||
['build', 'sourcesJar', 'javadocJar'].each { task ->
|
||||
t.dependsOn ":imgui-$module:$task"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tool
|
||||
|
||||
import groovy.transform.CompileStatic
|
||||
import org.gradle.api.DefaultTask
|
||||
import org.gradle.api.tasks.Internal
|
||||
import org.gradle.api.tasks.TaskAction
|
||||
|
||||
@CompileStatic
|
||||
class UpVersion extends DefaultTask {
|
||||
@Internal
|
||||
String group = 'build'
|
||||
@Internal
|
||||
String description = 'Up project version to the next one.'
|
||||
|
||||
private final String currentVersion = project.findProperty('version')
|
||||
private final String nextVersion = project.findProperty('next')
|
||||
|
||||
@TaskAction
|
||||
void up() {
|
||||
if (!currentVersion) {
|
||||
throw new IllegalArgumentException('No property was found: "version"')
|
||||
}
|
||||
if (!nextVersion) {
|
||||
throw new IllegalArgumentException('No property was found: "next"')
|
||||
}
|
||||
|
||||
def propsFile = project.file('gradle.properties')
|
||||
propsFile.text = propsFile.text.replace("version=$currentVersion", "version=$nextVersion")
|
||||
|
||||
def readmeFile = project.file('README.md')
|
||||
readmeFile.text = readmeFile.text.replace(currentVersion, nextVersion)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -43,6 +43,7 @@ jar {
|
||||
|
||||
shadowJar {
|
||||
with jar
|
||||
archiveClassifier.set(null)
|
||||
}
|
||||
|
||||
apply from: "$rootDir/publish.gradle"
|
||||
|
||||
@@ -9,21 +9,25 @@ def packageDesc = 'Native binaries for imgui-java binding for Linux'
|
||||
def fromDir = '../bin'
|
||||
def libName = 'libimgui-java64.so'
|
||||
|
||||
if (System.getProperty('deployWin')) {
|
||||
packageName = 'imgui-java-natives-windows'
|
||||
packageDesc = 'Native binaries for imgui-java binding for Windows'
|
||||
libName = 'imgui-java64.dll'
|
||||
} else if (System.getProperty('deployLinux')) {
|
||||
packageName = 'imgui-java-natives-linux'
|
||||
packageDesc = 'Native binaries for imgui-java binding for Linux'
|
||||
libName = 'libimgui-java64.so'
|
||||
} else if (System.getProperty('deployMac')) {
|
||||
packageName = 'imgui-java-natives-macos'
|
||||
packageDesc = 'Native binaries for imgui-java binding for MacOS'
|
||||
libName = 'libimgui-java64.dylib'
|
||||
switch (findProperty('deployType')) {
|
||||
case 'win':
|
||||
packageName = 'imgui-java-natives-windows'
|
||||
packageDesc = 'Native binaries for imgui-java binding for Windows'
|
||||
libName = 'imgui-java64.dll'
|
||||
break
|
||||
case 'linux':
|
||||
packageName = 'imgui-java-natives-linux'
|
||||
packageDesc = 'Native binaries for imgui-java binding for Linux'
|
||||
libName = 'libimgui-java64.so'
|
||||
break
|
||||
case 'mac':
|
||||
packageName = 'imgui-java-natives-macos'
|
||||
packageDesc = 'Native binaries for imgui-java binding for MacOS'
|
||||
libName = 'libimgui-java64.dylib'
|
||||
break
|
||||
}
|
||||
|
||||
if (System.getProperty('freetype')) {
|
||||
if (findProperty('freetype') == 'true') {
|
||||
packageName += '-ft'
|
||||
packageDesc += ' with Freetype support'
|
||||
fromDir += '/freetype'
|
||||
|
||||
@@ -307,16 +307,8 @@ public final class ImGuizmo {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Checks if we're over the current operation
|
||||
*
|
||||
* One of:
|
||||
* <table summary="">
|
||||
* <tr>
|
||||
* <td>{@link imgui.extension.imguizmo.flag.Operation#ROTATE}</td>
|
||||
* <td>{@link imgui.extension.imguizmo.flag.Operation#SCALE}</td>
|
||||
* <td>{@link imgui.extension.imguizmo.flag.Operation#TRANSLATE}</td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* Checks if we're over the current operation.
|
||||
* One of {@link imgui.extension.imguizmo.flag.Operation}.
|
||||
*
|
||||
* @param operation target
|
||||
*/
|
||||
|
||||
+5
-2
@@ -17,8 +17,8 @@ ext.configurePublishing = { packageName, packageDesc ->
|
||||
def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots'
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
credentials {
|
||||
username = findProperty('nexusUpdId') ?: ''
|
||||
password = findProperty('nexusUpdPass') ?: ''
|
||||
username = System.getenv('NEXUS_UPD_ID')
|
||||
password = System.getenv('NEXUS_UPD_PASS')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +59,9 @@ ext.configurePublishing = { packageName, packageDesc ->
|
||||
}
|
||||
}
|
||||
signing {
|
||||
def signingKeyId = System.getenv('SIGNING_KEY_ID')
|
||||
def signingKey = System.getenv('SIGNING_KEY')
|
||||
useInMemoryPgpKeys(signingKeyId, signingKey, '')
|
||||
sign publishing.publications.mavenJava
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user