Skip to content

Commit

Permalink
feat: Revamp actions with new release and upload system
Browse files Browse the repository at this point in the history
  • Loading branch information
benwoo1110 committed Aug 24, 2023
1 parent 41940f9 commit 4410a1e
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 229 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-signportals
release_mode: ${{ inputs.release_mode }}
version_bump: ${{ inputs.version_bump }}
promote_from: ${{ inputs.promote_from }}
65 changes: 65 additions & 0 deletions .github/workflows/call.platform_uploads.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
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-signportals

modrinth_project_id: WuErDeI1
modrinth_dependencies: >
[
{"project_id": "3wmN97b8", "dependency_type": "required"}
]
dbo_project_id: 31376
dbo_project_relations: >
[
{"slug": "multiverse-core", "type": "requiredDependency"}
]
hangar_slug: Multiverse-SignPortals
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 }}
55 changes: 0 additions & 55 deletions .github/workflows/dbo_upload.yml

This file was deleted.

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"
9 changes: 8 additions & 1 deletion .github/workflows/test.yml → .github/workflows/pr.test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run unit tests against all PRs
name: 'PR: Test'

on:
pull_request:
Expand Down Expand Up @@ -26,4 +26,11 @@ jobs:
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
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.

Loading

0 comments on commit 4410a1e

Please sign in to comment.