Skip to content

Commit

Permalink
Merge pull request #260 from Multiverse/gradle-revamp
Browse files Browse the repository at this point in the history
feat: Implement gradle build
  • Loading branch information
benwoo1110 authored Aug 25, 2023
2 parents 95042d6 + 7a3c881 commit 73a46e5
Show file tree
Hide file tree
Showing 18 changed files with 873 additions and 210 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/build.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/call.github_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: 'Call: GitHub Release'

on:
workflow_call:
inputs:
release_mode:
description: 'Release mode'
required: true
type: string
version_bump:
description: 'Version bump'
required: false
type: string
promote_from:
description: 'Promote from'
required: false
type: string
outputs:
release_created:
description: 'Release created'
value: ${{ jobs.github_release.outputs.release_created }}
tag_name:
description: 'Tag name'
value: ${{ jobs.github_release.outputs.tag_name }}

jobs:
github_release:
uses: Multiverse/Multiverse-Core/.github/workflows/generic.github_release.yml@main
secrets: inherit
with:
plugin_name: multiverse-netherportals
release_mode: ${{ inputs.release_mode }}
version_bump: ${{ inputs.version_bump }}
promote_from: ${{ inputs.promote_from }}
75 changes: 75 additions & 0 deletions .github/workflows/call.platform_uploads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: 'Call: Platform Uploads'

on:
workflow_call:
inputs:
target_tag:
description: 'Version to upload'
required: true
type: string
upload_modrinth:
description: 'Upload to modrinth.com'
required: true
type: string
upload_dbo:
description: 'Upload to dev.bukkit.org'
required: true
type: string
upload_hangar:
description: 'Upload to hangar.papermc.io'
required: true
type: string
secrets:
MODRINTH_TOKEN:
required: true
DBO_UPLOAD_API_TOKEN:
required: true
HANGAR_UPLOAD_TOKEN:
required: true

jobs:
platform_uploads:
uses: Multiverse/Multiverse-Core/.github/workflows/generic.platform_uploads.yml@main
secrets: inherit
with:
plugin_name: multiverse-netherportals

modrinth_project_id: vtawPsTo
modrinth_dependencies: >
[
{"project_id": "3wmN97b8", "dependency_type": "required"}
{"slug": "8VMk6P0I", "type": "optional"}
]
dbo_project_id: 30783
dbo_project_relations: >
[
{"slug": "multiverse-core", "type": "requiredDependency"},
{"slug": "multiverse-portals", "type": "optionalDependency"}
]
hangar_slug: Multiverse-NetherPortals
hangar_plugin_dependencies: >
{ "PAPER": [
{
"name": "Multiverse-Core",
"required": true,
"namespace": {
"owner": "Multiverse",
"slug": "Multiverse-Core"
}
},
{
"name": "Multiverse-Portals",
"required": false,
"namespace": {
"owner": "Multiverse",
"slug": "Multiverse-Portals"
}
}
]}
target_tag: ${{ inputs.target_tag }}
upload_modrinth: ${{ inputs.upload_modrinth }}
upload_dbo: ${{ inputs.upload_dbo }}
upload_hangar: ${{ inputs.upload_hangar }}
31 changes: 31 additions & 0 deletions .github/workflows/dispatch.platform_uploads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Dispatch: Platform Uploads'

on:
workflow_dispatch:
inputs:
target_tag:
description: 'Version to upload'
required: true
type: string
upload_modrinth:
description: 'Upload to modrinth.com'
required: true
type: boolean
upload_dbo:
description: 'Upload to dev.bukkit.org'
required: true
type: boolean
upload_hangar:
description: 'Upload to hangar.papermc.io'
required: true
type: boolean

jobs:
dispatch_platform_uploads:
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ github.event.inputs.target_tag }}
upload_modrinth: ${{ github.event.inputs.upload_modrinth }}
upload_dbo: ${{ github.event.inputs.upload_dbo }}
upload_hangar: ${{ github.event.inputs.upload_hangar }}
38 changes: 38 additions & 0 deletions .github/workflows/dispatch.promote_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'Dispatch: Promote Release'

on:
workflow_dispatch:
inputs:
target_tag:
description: 'Version to promote'
required: true

jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: Verify input version is prerelease
run: |
if [[ "${{ github.event.inputs.target_tag }}" != *"pre"* ]]; then
echo "Version must be a prerelease"
exit 1
fi
github_release:
needs: check_version
uses: ./.github/workflows/call.github_release.yml
secrets: inherit
with:
release_mode: promote
promote_from: ${{ github.event.inputs.target_tag }}

platform_uploads:
needs: github_release
if: needs.github_release.outputs.release_created == 'true'
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ needs.github_release.outputs.tag_name }}
upload_modrinth: 'true'
upload_dbo: 'true'
upload_hangar: 'true'
24 changes: 24 additions & 0 deletions .github/workflows/main.prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Main: Prerelease'

on:
push:
branches: [main]

jobs:
github_release_on_push:
uses: ./.github/workflows/call.github_release.yml
secrets: inherit
with:
release_mode: prerelease
version_bump: prlabel

platform_uploads_on_push:
needs: github_release_on_push
if: needs.github_release_on_push.outputs.release_created == 'true'
uses: ./.github/workflows/call.platform_uploads.yml
secrets: inherit
with:
target_tag: ${{ needs.github_release_on_push.outputs.tag_name }}
upload_modrinth: 'true'
upload_dbo: 'false'
upload_hangar: 'false'
18 changes: 18 additions & 0 deletions .github/workflows/pr.require_label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'PR: Require Label'

on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
branches: [main]

jobs:
require_label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 1
labels: "release:major, release:minor, release:patch, no release"
36 changes: 36 additions & 0 deletions .github/workflows/pr.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'PR: Test'

on:
pull_request:
types: [opened, synchronize]

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Run unit tests
uses: gradle/gradle-build-action@v2
with:
arguments: build
env:
GITHUB_VERSION: pr${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Artifact output
uses: actions/upload-artifact@v3
with:
name: multiverse-core-pr${{ github.event.pull_request.number }}
path: build/libs/multiverse-core-pr${{ github.event.pull_request.number }}.jar
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ debug.log
# Doxygen
/docs/html
debug.txt

# Gradle
.gradle
Loading

0 comments on commit 73a46e5

Please sign in to comment.