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:
workflow_dispatch:
@ -11,6 +11,14 @@ jobs:
manually_upload_dbo_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: Download release artifact
id: release-artifact
uses: dsaltares/fetch-gh-release-asset@master
@ -19,40 +27,29 @@ jobs:
version: tags/${{ github.event.inputs.version }}
file: multiverse-core-${{ github.event.inputs.version }}.jar
- name: Build DBO metadata
id: metadata
uses: nickofthyme/object-remap@v1
with:
changelog: ${{ toJson(steps.release-artifact.outputs.body) }}
changelog_type: markdown
release_type: release
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: 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
- name: Upload to dev.bukkit.org
uses: Multiverse/http-request-action@debug
uses: benwoo1110/dbo-upload-action@v0.1.0
with:
url: https://dev.bukkit.org/api/projects/30765/upload-file
method: POST
contentType: multipart/form-data
customHeaders: '{ "X-Api-Token": "${{ secrets.DBO_UPLOAD_API_TOKEN }}" }'
files: '{ "file": "${{ github.workspace }}/multiverse-core-${{ github.event.inputs.version }}.jar" }'
data: '{ "metadata": ${{ toJson(steps.metadata.outputs.json) }} }'
# Bukkit Version IDs
# 9994: 1.20.1
# 9974: 1.20
# 9973: 1.19.4
# 9561: 1.19.3
# 9560: 1.19.2
# 9261: 1.19.1
# 9190: 1.19
# 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
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
project_id: 30765
changelog: ${{ steps.release-artifact.outputs.body }}
changelog_type: markdown
display_name: ${{ steps.release-artifact.outputs.version }}
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-artifact.outputs.version }}.jar

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:
workflow_dispatch:
@ -6,14 +6,6 @@ on:
version:
description: 'Version to promote'
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:
manually_promote_release:
@ -47,31 +39,20 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Remove prerelease tag
run: |
echo "Removing prerelease tag from version"
echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV
- name: Build
- name: Build and test
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x test -x checkstyleMain -x checkstyleTest
arguments: clean build -x assemble -x shadowJar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }}
- name: Create release
id: release
uses: Multiverse/release-on-push-action@skip_prs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: benwoo1110/semantic-release-action@main
with:
bump_version_scheme: ${{ github.event.inputs.version-bump }}
tag_prefix: ''
release_name: "<RELEASE_VERSION>"
use_github_release_notes: true
ref: ${{ steps.get-release.outputs.target_commitish }}
skip_prs: true
github_token: ${{ secrets.GITHUB_TOKEN }}
version_bump: promote
promote_from: ${{ github.event.inputs.version }}
- name: Publish package
uses: gradle/gradle-build-action@v2
@ -79,30 +60,50 @@ jobs:
arguments: publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_VERSION: ${{ env.VERSION }}
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
- name: Upload release artifact
uses: svenstaro/upload-release-action@v2
with:
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
tag: ${{ steps.release.outputs.tag_name }}
- name: Get Changelog
id: changelog
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download release artifact
id: release-artifact
uses: dsaltares/fetch-gh-release-asset@v1
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
with:
arguments: build modrinth
env:
GITHUB_VERSION: ${{ env.VERSION }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.changelog.outputs.body }}
PRERELEASE: ${{ steps.changelog.outputs.prerelease }}
CHANGELOG: ${{ steps.release.outputs.body }}
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
uses: gradle/wrapper-validation-action@v1
- name: Test & Build
- name: Build and test
uses: gradle/gradle-build-action@v2
with:
arguments: clean build -x assemble -x shadowJar
@ -28,55 +28,66 @@ jobs:
- name: Create release
id: release
uses: Multiverse/release-on-push-action@support_prerelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: benwoo1110/semantic-release-action@main
with:
bump_version_scheme: norelease
tag_prefix: ''
release_name: "<RELEASE_VERSION>"
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
github_token: ${{ secrets.GITHUB_TOKEN }}
version_bump: prlabel
release_mode: prerelease
- name: Publish package
if: steps.release.outputs.release_created == 'true'
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_VERSION: ${{ env.VERSION }}
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
if: steps.release.outputs.release_created == 'true'
uses: svenstaro/upload-release-action@v2
with:
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
tag: ${{ steps.release.outputs.tag_name }}
- name: Get Changelog
id: changelog
uses: cardinalby/git-get-release-action@1.2.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download release artifact
if: steps.release.outputs.release_created == 'true'
uses: dsaltares/fetch-gh-release-asset@v1
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
with:
arguments: build modrinth
arguments: build modrinth -x checkstyleMain -x checkstyleTest
env:
GITHUB_VERSION: ${{ env.VERSION }}
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CHANGELOG: ${{ steps.changelog.outputs.body }}
PRERELEASE: ${{ steps.changelog.outputs.prerelease }}
CHANGELOG: ${{ steps.release.outputs.body }}
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:
mode: exactly
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 {
token = System.getenv("MODRINTH_TOKEN")
projectId = "multiverse-core"
versionNumber = version
if(System.getenv("PRERELEASE")) {
versionType = "beta"
} else {
versionType = "release"
}
versionNumber = System.getenv("VERSION_NUMBER")
versionType = System.getenv("VERSION_TYPE")
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"]
loaders = ["bukkit", "spigot", "paper"]