Merge pull request #2951 from Multiverse/release-actions

Revamp release actions
This commit is contained in:
Jeremy Wood 2023-08-21 22:44:19 -04:00 committed by GitHub
commit 350d228975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 168 additions and 131 deletions

2
.github/labeler.yml vendored
View File

@ -1,2 +0,0 @@
prerelease:
- '*'

View File

@ -1,4 +1,4 @@
name: Manually upload release to dev.bukkit.org name: Manually upload specific release to dev.bukkit.org
on: on:
workflow_dispatch: workflow_dispatch:
@ -11,6 +11,14 @@ jobs:
manually_upload_dbo_release: manually_upload_dbo_release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get release info
id: release-info
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.release.outputs.tag_name }}
- name: Download release artifact - name: Download release artifact
id: release-artifact id: release-artifact
uses: dsaltares/fetch-gh-release-asset@master uses: dsaltares/fetch-gh-release-asset@master
@ -19,40 +27,29 @@ jobs:
version: tags/${{ github.event.inputs.version }} version: tags/${{ github.event.inputs.version }}
file: multiverse-core-${{ github.event.inputs.version }}.jar file: multiverse-core-${{ github.event.inputs.version }}.jar
- name: Build DBO metadata - name: Parse release type
id: metadata run: |
uses: nickofthyme/object-remap@v1 if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
with: echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
changelog: ${{ toJson(steps.release-artifact.outputs.body) }} else
changelog_type: markdown echo "RELEASE_TYPE=release" >> $GITHUB_ENV
release_type: release fi
display_name: ${{ github.event.inputs.version }}
game_versions: '[9994, 9974, 9973, 9561, 9560, 9261, 9190, 9016, 8897, 8849, 8503, 7915, 7667, 7330, 7105]'
relations.projects: '[{"slug": "multiverse-netherportals", "type": "optionalDependency"}, {"slug": "multiverse-portals", "type": "optionalDependency"}, {"slug": "multiverse-inventories", "type": "optionalDependency"}, {"slug": "multiverse-signportals", "type": "optionalDependency"}]'
- name: Upload to dev.bukkit.org - name: Upload to dev.bukkit.org
uses: Multiverse/http-request-action@debug uses: benwoo1110/dbo-upload-action@v0.1.0
with: with:
url: https://dev.bukkit.org/api/projects/30765/upload-file api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
method: POST project_id: 30765
contentType: multipart/form-data changelog: ${{ steps.release-artifact.outputs.body }}
customHeaders: '{ "X-Api-Token": "${{ secrets.DBO_UPLOAD_API_TOKEN }}" }' changelog_type: markdown
files: '{ "file": "${{ github.workspace }}/multiverse-core-${{ github.event.inputs.version }}.jar" }' display_name: ${{ steps.release-artifact.outputs.version }}
data: '{ "metadata": ${{ toJson(steps.metadata.outputs.json) }} }' game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1
release_type: ${{ env.RELEASE_TYPE }}
# Bukkit Version IDs project_relations: >
# 9994: 1.20.1 [
# 9974: 1.20 {"slug": "multiverse-portals", "type": "optionalDependency"},
# 9973: 1.19.4 {"slug": "multiverse-netherportals", "type": "optionalDependency"},
# 9561: 1.19.3 {"slug": "multiverse-signportals", "type": "optionalDependency"},
# 9560: 1.19.2 {"slug": "multiverse-inventories", "type": "optionalDependency"}
# 9261: 1.19.1 ]
# 9190: 1.19 file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar
# 9016: 1.18.2
# 8897: 1.18.1
# 8849: 1.18
# 8503: 1.17
# 7915: 1.16
# 7667: 1.15
# 7330: 1.14
# 7105: 1.13

53
.github/workflows/modrinth_upload.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Manually upload specific release to modrinth.com
on:
workflow_dispatch:
inputs:
version:
description: 'Release to upload'
required: true
jobs:
manually_upload_modrinth_release:
runs-on: ubuntu-latest
steps:
- name: Get release info
id: release-info
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag: ${{ steps.release.outputs.tag_name }}
- name: Modify version scheme
run: |
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
echo "Replacing prerelease version scheme with SNAPSHOT"
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
else
echo "Using release version scheme"
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
fi
- name: Parse release type
run: |
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
else
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
with:
ref: ${{ steps.release-info.outputs.tag_name }}
- name: Upload to modrinth.com
uses: gradle/gradle-build-action@v2
with:
arguments: build modrinth
env:
GITHUB_VERSION: ${{ env.VERSION }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.release-info.outputs.body }}
VERSION_NUMBER: ${{ steps.release-info.outputs.tag_name }}
VERSION_TYPE: ${{ env.RELEASE_TYPE }}

View File

@ -1,17 +0,0 @@
name: "Pull Request Labeler"
on:
pull_request_target:
types: [opened]
branches: [main]
jobs:
prerelease_labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

View File

@ -1,4 +1,4 @@
name: Manually promote last prerelease to release name: Manually promote prerelease to release
on: on:
workflow_dispatch: workflow_dispatch:
@ -6,14 +6,6 @@ on:
version: version:
description: 'Version to promote' description: 'Version to promote'
required: true required: true
version-bump:
description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release'
required: true
type: choice
options:
- 'patch'
- 'minor'
- 'major'
jobs: jobs:
manually_promote_release: manually_promote_release:
@ -47,31 +39,20 @@ jobs:
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Remove prerelease tag - name: Build and test
run: |
echo "Removing prerelease tag from version"
echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV
- name: Build
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: clean build -x test -x checkstyleMain -x checkstyleTest arguments: clean build -x assemble -x shadowJar
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }}
- name: Create release - name: Create release
id: release id: release
uses: Multiverse/release-on-push-action@skip_prs uses: benwoo1110/semantic-release-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
bump_version_scheme: ${{ github.event.inputs.version-bump }} github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: '' version_bump: promote
release_name: "<RELEASE_VERSION>" promote_from: ${{ github.event.inputs.version }}
use_github_release_notes: true
ref: ${{ steps.get-release.outputs.target_commitish }}
skip_prs: true
- name: Publish package - name: Publish package
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
@ -79,30 +60,50 @@ jobs:
arguments: publish arguments: publish
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
- name: Upload release artifact - name: Upload release artifact
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/multiverse-core-${{ env.VERSION }}.jar file: build/libs/multiverse-core-${{ steps.release.outputs.publish_version }}.jar
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }} tag: ${{ steps.release.outputs.tag_name }}
- name: Get Changelog - name: Download release artifact
id: changelog id: release-artifact
uses: cardinalby/git-get-release-action@1.2.4 uses: dsaltares/fetch-gh-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag: ${{ steps.release.outputs.tag_name }} token: ${{ secrets.GITHUB_TOKEN }}
version: tags/${{ steps.release.outputs.tag_name }}
file: multiverse-core-${{ github.event.inputs.version }}.jar
- name: Modrinth Upload - name: Upload to modrinth.com
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: build modrinth arguments: build modrinth
env: env:
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ env.VERSION }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.changelog.outputs.body }} CHANGELOG: ${{ steps.release.outputs.body }}
PRERELEASE: ${{ steps.changelog.outputs.prerelease }} VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
VERSION_TYPE: ${{ env.RELEASE_TYPE }}
- name: Upload to dev.bukkit.org
uses: benwoo1110/dbo-upload-action@v0.2.0
with:
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: 30765
changelog: ${{ steps.release.outputs.body }}
changelog_type: markdown
display_name: ${{ steps.release.outputs.tag_name }}
game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1
release_type: ${{ env.RELEASE_TYPE }}
project_relations: >
[
{"slug": "multiverse-portals", "type": "optionalDependency"},
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
{"slug": "multiverse-signportals", "type": "optionalDependency"},
{"slug": "multiverse-inventories", "type": "optionalDependency"}
]
file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release.outputs.tag_name }}.jar

View File

@ -19,7 +19,7 @@ jobs:
- name: Validate Gradle wrapper - name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Test & Build - name: Build and test
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: clean build -x assemble -x shadowJar arguments: clean build -x assemble -x shadowJar
@ -28,55 +28,66 @@ jobs:
- name: Create release - name: Create release
id: release id: release
uses: Multiverse/release-on-push-action@support_prerelease uses: benwoo1110/semantic-release-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
bump_version_scheme: norelease github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: '' version_bump: prlabel
release_name: "<RELEASE_VERSION>" release_mode: prerelease
use_github_release_notes: true
- name: Modify version scheme
run: |
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
echo "Replacing prerelease version scheme with SNAPSHOT"
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
else
echo "Using release version scheme"
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
fi
- name: Publish package - name: Publish package
if: steps.release.outputs.release_created == 'true'
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: publish arguments: publish
env: env:
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact - name: Upload release artifact
if: steps.release.outputs.release_created == 'true'
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
with: with:
repo_token: ${{ secrets.GITHUB_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/libs/multiverse-core-${{ env.VERSION }}.jar file: build/libs/multiverse-core-${{ steps.release.outputs.publish_version }}.jar
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
tag: ${{ steps.release.outputs.tag_name }} tag: ${{ steps.release.outputs.tag_name }}
- name: Get Changelog - name: Download release artifact
id: changelog if: steps.release.outputs.release_created == 'true'
uses: cardinalby/git-get-release-action@1.2.4 uses: dsaltares/fetch-gh-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag: ${{ steps.release.outputs.tag_name }} token: ${{ secrets.GITHUB_TOKEN }}
version: tags/${{ steps.release.outputs.tag_name }}
file: multiverse-core-${{ github.event.inputs.version }}.jar
- name: Modrinth Upload - name: Upload to modrinth.com
if: steps.release.outputs.release_created == 'true'
uses: gradle/gradle-build-action@v2 uses: gradle/gradle-build-action@v2
with: with:
arguments: build modrinth arguments: build modrinth -x checkstyleMain -x checkstyleTest
env: env:
GITHUB_VERSION: ${{ env.VERSION }} GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.changelog.outputs.body }} CHANGELOG: ${{ steps.release.outputs.body }}
PRERELEASE: ${{ steps.changelog.outputs.prerelease }} VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
VERSION_TYPE: ${{ steps.release.outputs.release_type }}
- name: Upload to dev.bukkit.org
if: steps.release.outputs.release_created == 'true'
uses: benwoo1110/dbo-upload-action@v0.2.0
with:
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: 30765
changelog: ${{ steps.release.outputs.body }}
changelog_type: markdown
display_name: ${{ steps.release.outputs.tag_name }}
game_versions: 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.18.1, 1.18.2, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20, 1.20.1
release_type: ${{ steps.release.outputs.release_type }}
project_relations: >
[
{"slug": "multiverse-portals", "type": "optionalDependency"},
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
{"slug": "multiverse-signportals", "type": "optionalDependency"},
{"slug": "multiverse-inventories", "type": "optionalDependency"}
]
file_path: ${{ github.workspace }}/multiverse-core-${{ steps.release.outputs.tag_name }}.jar

View File

@ -15,4 +15,4 @@ jobs:
with: with:
mode: exactly mode: exactly
count: 1 count: 1
labels: "release:major, release:minor, release:patch, no version bump" labels: "release:major, release:minor, release:patch, no release"

View File

@ -181,14 +181,8 @@ jar.enabled = false
modrinth { modrinth {
token = System.getenv("MODRINTH_TOKEN") token = System.getenv("MODRINTH_TOKEN")
projectId = "multiverse-core" projectId = "multiverse-core"
versionNumber = version versionNumber = System.getenv("VERSION_NUMBER")
versionType = System.getenv("VERSION_TYPE")
if(System.getenv("PRERELEASE")) {
versionType = "beta"
} else {
versionType = "release"
}
uploadFile = jar uploadFile = jar
gameVersions = ["1.20.1", "1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.18.1", "1.18", "1.17.1", "1.17", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16", "1.15.2", "1.15.1", "1.15", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14", "1.13.2", "1.13.1", "1.13"] gameVersions = ["1.20.1", "1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.18.1", "1.18", "1.17.1", "1.17", "1.16.5", "1.16.4", "1.16.3", "1.16.2", "1.16.1", "1.16", "1.15.2", "1.15.1", "1.15", "1.14.4", "1.14.3", "1.14.2", "1.14.1", "1.14", "1.13.2", "1.13.1", "1.13"]
loaders = ["bukkit", "spigot", "paper"] loaders = ["bukkit", "spigot", "paper"]