Skip to content

Commit

Permalink
Merge pull request #659 from Multiverse/actions-revamp
Browse files Browse the repository at this point in the history
feat: Revamp actions with new release and upload system
  • Loading branch information
benwoo1110 committed Aug 25, 2023
2 parents 280e88c + 59db7d9 commit 6e6c04a
Show file tree
Hide file tree
Showing 12 changed files with 206 additions and 202 deletions.
2 changes: 0 additions & 2 deletions .github/labeler.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-portals
release_mode: ${{ inputs.release_mode }}
version_bump: ${{ inputs.version_bump }}
promote_from: ${{ inputs.promote_from }}
66 changes: 66 additions & 0 deletions .github/workflows/call.platform_uploads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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-portals

modrinth_project_id: 8VMk6P0I
modrinth_dependencies: >
[
{"project_id": "3wmN97b8", "dependency_type": "required"}
]
dbo_project_id: 30781
dbo_project_relations: >
[
{"slug": "multiverse-core", "type": "requiredDependency"},
{"slug": "worldedit", "type": "optionalDependency"}
]
hangar_slug: Multiverse-Portals
hangar_plugin_dependencies: >
{ "PAPER": [
{
"name": "Multiverse-Core",
"required": true,
"namespace": {
"owner": "Multiverse",
"slug": "Multiverse-Core"
}
}
]}
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'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Require PR Labels
name: 'PR: Require Label'

on:
pull_request:
Expand All @@ -15,4 +15,4 @@ jobs:
with:
mode: exactly
count: 1
labels: "release:major, release:minor, release:patch, no version bump"
labels: "release:major, release:minor, release:patch, no release"
11 changes: 11 additions & 0 deletions .github/workflows/pr.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 'PR: Test'

on:
pull_request:
types: [opened, synchronize]

jobs:
test:
uses: Multiverse/Multiverse-Core/.github/workflows/generic.test.yml@main
with:
plugin_name: multiverse-portals
17 changes: 0 additions & 17 deletions .github/workflows/pr_labeler.yml

This file was deleted.

88 changes: 0 additions & 88 deletions .github/workflows/promote_release.yml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit 6e6c04a

Please sign in to comment.