mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-12-04 16:33:28 +01:00
chore(ci): Swapping build pipeline
This commit is contained in:
parent
b1be39b908
commit
bfea4b2836
32
.autorc
Normal file
32
.autorc
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"baseBranch": "spigot-1.13-1.16",
|
||||||
|
"plugins": [
|
||||||
|
[
|
||||||
|
"gradle",
|
||||||
|
{
|
||||||
|
"gradleCommand": "./gradlew",
|
||||||
|
"gradleOptions": [""]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"exec",
|
||||||
|
{
|
||||||
|
"canary": "./gradlew build discord"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
["conventional-commits", { "preset": "angular" }],
|
||||||
|
"released",
|
||||||
|
["upload-assets", ["./build/libs/*.jar"]]
|
||||||
|
],
|
||||||
|
"owner": "sekwah41",
|
||||||
|
"repo": "Advanced-Portals",
|
||||||
|
"name": "Sekwah",
|
||||||
|
"email": "contact@sekwah.com",
|
||||||
|
"onlyPublishWithReleaseLabel": true,
|
||||||
|
"shipit": {
|
||||||
|
"onlyGraduateWithReleaseLabel": true
|
||||||
|
},
|
||||||
|
"canary": {
|
||||||
|
"message": "📦 Published PR to [discord](https://discord.sekwah.com/) as canary version: %v"
|
||||||
|
}
|
||||||
|
}
|
49
.github/workflows/gradle.yml
vendored
49
.github/workflows/gradle.yml
vendored
@ -1,12 +1,6 @@
|
|||||||
name: Build Project
|
name: Release
|
||||||
|
|
||||||
on:
|
on: [push]
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '**'
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -15,26 +9,39 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK 8
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
distribution: 'zulu'
|
|
||||||
java-version: '8.0'
|
|
||||||
- name: Cache Gradle packages
|
- name: Cache Gradle packages
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/caches
|
path: ~/.gradle/caches
|
||||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
|
||||||
restore-keys: ${{ runner.os }}-gradle
|
restore-keys: ${{ runner.os }}-gradle
|
||||||
|
- name: Cache Node packages
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: node_modules
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
|
||||||
|
restore-keys: ${{ runner.os }}-node
|
||||||
|
- name: Set up JDK 8
|
||||||
|
uses: actions/setup-java@v2
|
||||||
|
with:
|
||||||
|
distribution: 'zulu'
|
||||||
|
java-version: 8
|
||||||
|
- name: Use Node.js 12.x
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 12.x
|
||||||
|
- name: Prepare repository
|
||||||
|
run: |
|
||||||
|
git fetch --unshallow --tags
|
||||||
|
yarn install --frozen-lockfile
|
||||||
|
echo $(yarn bin) >> $GITHUB_PATH
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: Upload to Discord (If pre-release tag)
|
- name: Create Release
|
||||||
if: "startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-')"
|
|
||||||
env:
|
|
||||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
||||||
run: ./gradlew discordupload
|
|
||||||
- name: Publish to Curseforge (If release tag)
|
|
||||||
if: "startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-')"
|
|
||||||
env:
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CURSE_API: ${{ secrets.CURSE_API }}
|
CURSE_API: ${{ secrets.CURSE_API }}
|
||||||
run: ./gradlew curseforge
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
run: |
|
||||||
|
npx auto shipit -v
|
||||||
|
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -7,10 +7,11 @@
|
|||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
|
|
||||||
|
node_modules/
|
||||||
*.iml
|
*.iml
|
||||||
*.iws
|
*.iws
|
||||||
*.ipr
|
*.ipr
|
||||||
|
.env
|
||||||
out/
|
out/
|
||||||
logs/
|
logs/
|
||||||
classes/
|
classes/
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
let versionRegex = /(\nversion:\s)([0-9.-]+)/;
|
|
||||||
let velocityVersionRegex = /(\sversion\s=\s")([0-9.-]+)("\))/;
|
|
||||||
|
|
||||||
|
|
||||||
const ymlUpdater = {
|
|
||||||
updater: {
|
|
||||||
'readVersion': (contents) => {
|
|
||||||
return versionRegex.exec(contents)[2];
|
|
||||||
},
|
|
||||||
'writeVersion': (contents, version) => {
|
|
||||||
return contents.replace(versionRegex, `$1${version}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const bungee = {
|
|
||||||
filename: 'src/main/resources/bungee.yml',
|
|
||||||
...ymlUpdater,
|
|
||||||
}
|
|
||||||
|
|
||||||
const plugin = {
|
|
||||||
filename: 'src/main/resources/plugin.yml',
|
|
||||||
...ymlUpdater,
|
|
||||||
}
|
|
||||||
|
|
||||||
const velocity_plugin = {
|
|
||||||
filename: 'src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java',
|
|
||||||
updater: {
|
|
||||||
'readVersion': (contents) => {
|
|
||||||
return velocityVersionRegex.exec(contents)[2];
|
|
||||||
},
|
|
||||||
'writeVersion': (contents, version) => {
|
|
||||||
return contents.replace(velocityVersionRegex, `$1${version}$3`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const files = [plugin, velocity_plugin, bungee];
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
bumpFiles: files,
|
|
||||||
packageFiles: files,
|
|
||||||
// In case you need to force a version change (mostly due to change of scope of the update e.g. major now instead of patch)
|
|
||||||
//releaseAs: '0.16.0',
|
|
||||||
header:"# Changelog\n" +
|
|
||||||
"\n" +
|
|
||||||
"All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.\n" +
|
|
||||||
"\n" +
|
|
||||||
"For the release changelogs see [CHANGELOG.md](CHANGELOG.md) \n" +
|
|
||||||
"For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md)\n",
|
|
||||||
}
|
|
@ -33,6 +33,10 @@ Usage stats can be found here https://bstats.org/plugin/bukkit/AdvancedPortals
|
|||||||
The api isn't implemented in this version, sorry for any inconvenience. Check the recode tree for possibly a working recode at some point.
|
The api isn't implemented in this version, sorry for any inconvenience. Check the recode tree for possibly a working recode at some point.
|
||||||
|
|
||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
|
Don't worry about updating the file numbers in `bungee.yml`, `plugin.yml` and `AdvancedPortalsPlugin.java`.
|
||||||
|
They will be updated automatically before builds.
|
||||||
|
|
||||||
Please ensure that your commits are in the following style for PR's
|
Please ensure that your commits are in the following style for PR's
|
||||||
|
|
||||||
https://www.conventionalcommits.org/en/v1.0.0/
|
https://www.conventionalcommits.org/en/v1.0.0/
|
||||||
|
127
build.gradle
127
build.gradle
@ -1,3 +1,4 @@
|
|||||||
|
import com.google.gson.Gson
|
||||||
import org.apache.commons.codec.Charsets
|
import org.apache.commons.codec.Charsets
|
||||||
import org.apache.http.HttpEntity
|
import org.apache.http.HttpEntity
|
||||||
import org.apache.http.HttpResponse
|
import org.apache.http.HttpResponse
|
||||||
@ -5,19 +6,16 @@ import org.apache.http.client.HttpClient
|
|||||||
import org.apache.http.client.config.CookieSpecs
|
import org.apache.http.client.config.CookieSpecs
|
||||||
import org.apache.http.client.config.RequestConfig
|
import org.apache.http.client.config.RequestConfig
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse
|
import org.apache.http.client.methods.CloseableHttpResponse
|
||||||
|
import org.apache.http.client.methods.HttpGet
|
||||||
import org.apache.http.client.methods.HttpPost
|
import org.apache.http.client.methods.HttpPost
|
||||||
import org.apache.http.entity.ContentType
|
import org.apache.http.entity.ContentType
|
||||||
import org.apache.http.entity.mime.MultipartEntityBuilder
|
import org.apache.http.entity.mime.MultipartEntityBuilder
|
||||||
import org.apache.http.impl.client.CloseableHttpClient
|
import org.apache.http.impl.client.CloseableHttpClient
|
||||||
import org.apache.http.impl.client.HttpClientBuilder
|
import org.apache.http.impl.client.HttpClientBuilder
|
||||||
import org.apache.http.impl.client.HttpClients
|
import org.apache.http.impl.client.HttpClients
|
||||||
import org.apache.http.client.methods.HttpGet
|
|
||||||
import com.google.gson.Gson
|
|
||||||
|
|
||||||
|
import java.util.regex.Matcher
|
||||||
apply plugin: 'java'
|
import java.util.regex.Pattern
|
||||||
apply plugin: 'maven-publish'
|
|
||||||
apply plugin: 'idea'
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
@ -33,12 +31,20 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id 'net.researchgate.release' version '2.8.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
def branch = System.getenv("GITHUB_REF");
|
def branch = System.getenv("GITHUB_REF");
|
||||||
def sha = System.getenv("GITHUB_SHA");
|
if (branch != null) {
|
||||||
def isDevBranch = branch == null || !(branch.startsWith("refs/tags/") && !branch.contains("-"))
|
branch = branch.replace('refs/heads/', '')
|
||||||
|
}
|
||||||
|
def isCanary = version.toString().contains('canary')
|
||||||
|
|
||||||
group = 'com.sekwah.advancedportals'
|
group = 'com.sekwah.advancedportals'
|
||||||
version = getPluginData("version") + (isDevBranch ? '-SNAPSHOT' : '')
|
|
||||||
|
|
||||||
description = ""
|
description = ""
|
||||||
|
|
||||||
@ -108,8 +114,13 @@ task discordupload {
|
|||||||
HttpPost uploadFile = new HttpPost(discordWebhook)
|
HttpPost uploadFile = new HttpPost(discordWebhook)
|
||||||
|
|
||||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
|
MultipartEntityBuilder builder = MultipartEntityBuilder.create()
|
||||||
builder.addTextBody("content", "New automated dev build\n\n" +
|
|
||||||
"Current Features: <${project.github}/blob/${sha}/docs/SNAPSHOT_CHANGELOG.md>")
|
if (isCanary) {
|
||||||
|
builder.addTextBody("content", "New canary Build")
|
||||||
|
} else {
|
||||||
|
builder.addTextBody("content", "New release build\n\n" +
|
||||||
|
"Current Features: <${project.github}/blob/${branch}/CHANGELOG.md>")
|
||||||
|
}
|
||||||
|
|
||||||
builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
|
builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
|
||||||
|
|
||||||
@ -315,42 +326,76 @@ task runJar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
task publish {
|
||||||
* These are needed as standard-version doesnt allow for the ability to skip tag versions for the changelog.
|
|
||||||
* Well it does but not on purpose and it breaks things.
|
|
||||||
*
|
|
||||||
* Tagging is skipped so that the release can be merged and confirmed (A little long winded but just to stop mistakes)
|
|
||||||
*/
|
|
||||||
task updateChangelog {
|
|
||||||
doLast {
|
doLast {
|
||||||
exec {
|
println "This is a dummy task to run others for version: ${version}"
|
||||||
commandLine 'cmd', '/c', 'npx standard-version@9.3.0 -i docs/CHANGELOG.md -t (v)[0-9]+.[0-0]+.[0-0]+(?!-) --skip.tag'
|
|
||||||
ext.output = {
|
|
||||||
return standardOutput.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exec {
|
|
||||||
commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --skip.changelog --skip.bump --skip.tag'
|
|
||||||
ext.output = {
|
|
||||||
return standardOutput.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task updateChangelogPreRelease(type: Exec) {
|
// https://github.com/researchgate/gradle-release
|
||||||
commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --prerelease -i docs/SNAPSHOT_CHANGELOG.md --skip.tag'
|
// Only other plugin I can find using auto & gradle https://github.com/intuit/hooks
|
||||||
ext.output = {
|
release {
|
||||||
return standardOutput.toString()
|
failOnPublishNeeded = false
|
||||||
|
failOnSnapshotDependencies = false
|
||||||
|
git {
|
||||||
|
requireBranch = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Disable tasks because something we have is causing -x to be ignored
|
||||||
|
createReleaseTag.enabled = false
|
||||||
|
preTagCommit.enabled = false
|
||||||
|
commitNewVersion.enabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
task cleanbuildfolder {
|
||||||
|
doFirst {
|
||||||
|
println "Cleaning up previous builds (to stop publishing old ones by mistake)"
|
||||||
|
project.delete(files("${buildDir}/libs"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void updateFileVersion(String fileLoc, Pattern pattern, Closure<String> stringClosure) {
|
||||||
* Just to stop having to manually tagging. Probably could do this easier but meh stops typos or other issues.
|
File file = new File(projectDir, fileLoc)
|
||||||
*/
|
Matcher m = pattern.matcher(file.text)
|
||||||
task tagRelease(type: Exec) {
|
if (m.find()) {
|
||||||
commandLine 'cmd', '/c', 'npx standard-version@9.3.0 --prerelease -i docs/SNAPSHOT_CHANGELOG.md --skip.changelog --skip.bump'
|
def newVersion = stringClosure.call(m)
|
||||||
ext.output = {
|
println "Replacing ${pattern.toString()} in ${fileLoc} with '${newVersion}'"
|
||||||
return standardOutput.toString()
|
file.text = file.text.replaceAll(pattern, newVersion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Just to keep all numbers the same (as they are dotted all over the place)
|
||||||
|
task updateVersionNumbers {
|
||||||
|
doFirst {
|
||||||
|
def versionRegex = ~/(\nversion:\s)([0-9.-]+)/
|
||||||
|
def velocityVersionRegex = ~/(\sversion\s=\s")([0-9.-]+)("\))/
|
||||||
|
|
||||||
|
updateFileVersion("src/main/resources/bungee.yml", versionRegex,
|
||||||
|
{ Matcher m ->
|
||||||
|
return "${m.group(1)}${getVersion()}"
|
||||||
|
})
|
||||||
|
|
||||||
|
updateFileVersion("src/main/resources/plugin.yml", versionRegex,
|
||||||
|
{ Matcher m ->
|
||||||
|
return "${m.group(1)}${getVersion()}"
|
||||||
|
})
|
||||||
|
|
||||||
|
updateFileVersion("src/main/java/com/sekwah/advancedportals/velocity/AdvancedPortalsPlugin.java",
|
||||||
|
velocityVersionRegex,
|
||||||
|
{ Matcher m ->
|
||||||
|
return "${m.group(1)}${getVersion()}${m.group(3)}"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileJava.dependsOn 'cleanbuildfolder'
|
||||||
|
compileJava.dependsOn 'updateVersionNumbers'
|
||||||
|
|
||||||
|
// Publish rules
|
||||||
|
// Current behavior seems to be canary or release. Though pre-releases may break this pattern.
|
||||||
|
publish.dependsOn 'build'
|
||||||
|
publish.finalizedBy 'discordupload'
|
||||||
|
if (!isCanary) {
|
||||||
|
publish.finalizedBy 'curseforge'
|
||||||
|
}
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
# Changelog
|
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
||||||
|
|
||||||
For the release changelogs see [CHANGELOG.md](CHANGELOG.md)
|
|
||||||
For the snapshot changelogs see [SNAPSHOT_CHANGELOG.md](SNAPSHOT_CHANGELOG.md)
|
|
||||||
|
|
||||||
### [0.5.13-2](https://github.com/sekwah41/Advanced-Portals/compare/v0.5.13-1...v0.5.13-2) (2021-05-14)
|
|
||||||
|
|
||||||
* No code changes, just updated the changelog generation.
|
|
||||||
|
|
||||||
### 0.5.13-1 (2021-05-12)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* Added configurable proxy teleport delay ([a1121ad](https://github.com/sekwah41/Advanced-Portals/commit/a1121adc10addfcce515d1358d1274232109fdfd))
|
|
||||||
|
|
||||||
### 0.5.13-0 (2021-05-12)
|
|
||||||
|
|
||||||
* Build Tool Change: Updated versioning and changelog tooling and standards.
|
|
||||||
* Added improved support for Velocity (You can now add it directly to Velocity as a plugin)
|
|
||||||
* Added a ForceEnableProxySupport config option in case any are not detected
|
|
||||||
* Modern forwarding will be automatically detected. You will no longer need to manually set ForceEnableProxySupport
|
|
||||||
|
|
||||||
|
|
@ -4,3 +4,4 @@ org.gradle.caching=true
|
|||||||
|
|
||||||
github=https://github.com/sekwah41/Advanced-Portals
|
github=https://github.com/sekwah41/Advanced-Portals
|
||||||
curse_project_id=86001
|
curse_project_id=86001
|
||||||
|
version=0.6.1
|
||||||
|
12
package.json
Normal file
12
package.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"conventional-changelog-angular": "5.0.12",
|
||||||
|
"@auto-it/conventional-commits": "^10.29.3",
|
||||||
|
"@auto-it/exec": "^10.29.3",
|
||||||
|
"@auto-it/first-time-contributor": "^10.29.3",
|
||||||
|
"@auto-it/gradle": "^10.29.3",
|
||||||
|
"@auto-it/released": "^10.29.3",
|
||||||
|
"@auto-it/upload-assets": "^10.29.3",
|
||||||
|
"auto": "^10.29.3"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user