Skip to content

Commit 350d228

Browse files
authored
Merge pull request #2951 from Multiverse/release-actions
Revamp release actions
2 parents 8865cfb + 2126efe commit 350d228

File tree

8 files changed

+168
-131
lines changed

8 files changed

+168
-131
lines changed

.github/labeler.yml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/dbo_upload.yml

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Manually upload release to dev.bukkit.org
1+
name: Manually upload specific release to dev.bukkit.org
22

33
on:
44
workflow_dispatch:
@@ -11,6 +11,14 @@ jobs:
1111
manually_upload_dbo_release:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- name: Get release info
15+
id: release-info
16+
uses: cardinalby/[email protected]
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag: ${{ steps.release.outputs.tag_name }}
21+
1422
- name: Download release artifact
1523
id: release-artifact
1624
uses: dsaltares/fetch-gh-release-asset@master
@@ -19,40 +27,29 @@ jobs:
1927
version: tags/${{ github.event.inputs.version }}
2028
file: multiverse-core-${{ github.event.inputs.version }}.jar
2129

22-
- name: Build DBO metadata
23-
id: metadata
24-
uses: nickofthyme/object-remap@v1
25-
with:
26-
changelog: ${{ toJson(steps.release-artifact.outputs.body) }}
27-
changelog_type: markdown
28-
release_type: release
29-
display_name: ${{ github.event.inputs.version }}
30-
game_versions: '[9994, 9974, 9973, 9561, 9560, 9261, 9190, 9016, 8897, 8849, 8503, 7915, 7667, 7330, 7105]'
31-
relations.projects: '[{"slug": "multiverse-netherportals", "type": "optionalDependency"}, {"slug": "multiverse-portals", "type": "optionalDependency"}, {"slug": "multiverse-inventories", "type": "optionalDependency"}, {"slug": "multiverse-signportals", "type": "optionalDependency"}]'
30+
- name: Parse release type
31+
run: |
32+
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
33+
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
34+
else
35+
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
36+
fi
3237
3338
- name: Upload to dev.bukkit.org
34-
uses: Multiverse/http-request-action@debug
39+
uses: benwoo1110/dbo-upload-action@v0.1.0
3540
with:
36-
url: https://dev.bukkit.org/api/projects/30765/upload-file
37-
method: POST
38-
contentType: multipart/form-data
39-
customHeaders: '{ "X-Api-Token": "${{ secrets.DBO_UPLOAD_API_TOKEN }}" }'
40-
files: '{ "file": "${{ github.workspace }}/multiverse-core-${{ github.event.inputs.version }}.jar" }'
41-
data: '{ "metadata": ${{ toJson(steps.metadata.outputs.json) }} }'
42-
43-
# Bukkit Version IDs
44-
# 9994: 1.20.1
45-
# 9974: 1.20
46-
# 9973: 1.19.4
47-
# 9561: 1.19.3
48-
# 9560: 1.19.2
49-
# 9261: 1.19.1
50-
# 9190: 1.19
51-
# 9016: 1.18.2
52-
# 8897: 1.18.1
53-
# 8849: 1.18
54-
# 8503: 1.17
55-
# 7915: 1.16
56-
# 7667: 1.15
57-
# 7330: 1.14
58-
# 7105: 1.13
41+
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
42+
project_id: 30765
43+
changelog: ${{ steps.release-artifact.outputs.body }}
44+
changelog_type: markdown
45+
display_name: ${{ steps.release-artifact.outputs.version }}
46+
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
47+
release_type: ${{ env.RELEASE_TYPE }}
48+
project_relations: >
49+
[
50+
{"slug": "multiverse-portals", "type": "optionalDependency"},
51+
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
52+
{"slug": "multiverse-signportals", "type": "optionalDependency"},
53+
{"slug": "multiverse-inventories", "type": "optionalDependency"}
54+
]
55+
file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release-artifact.outputs.version }}.jar

.github/workflows/modrinth_upload.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Manually upload specific release to modrinth.com
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Release to upload'
8+
required: true
9+
10+
jobs:
11+
manually_upload_modrinth_release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Get release info
15+
id: release-info
16+
uses: cardinalby/[email protected]
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag: ${{ steps.release.outputs.tag_name }}
21+
22+
- name: Modify version scheme
23+
run: |
24+
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
25+
echo "Replacing prerelease version scheme with SNAPSHOT"
26+
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
27+
else
28+
echo "Using release version scheme"
29+
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
30+
fi
31+
32+
- name: Parse release type
33+
run: |
34+
if [[ "${{ steps.release-info.outputs.prerelease }}" == "true" ]]; then
35+
echo "RELEASE_TYPE=beta" >> $GITHUB_ENV
36+
else
37+
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
38+
fi
39+
40+
- uses: actions/checkout@v3
41+
with:
42+
ref: ${{ steps.release-info.outputs.tag_name }}
43+
44+
- name: Upload to modrinth.com
45+
uses: gradle/gradle-build-action@v2
46+
with:
47+
arguments: build modrinth
48+
env:
49+
GITHUB_VERSION: ${{ env.VERSION }}
50+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
51+
CHANGELOG: ${{ steps.release-info.outputs.body }}
52+
VERSION_NUMBER: ${{ steps.release-info.outputs.tag_name }}
53+
VERSION_TYPE: ${{ env.RELEASE_TYPE }}

.github/workflows/pr_labeler.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/promote_release.yml

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
name: Manually promote last prerelease to release
1+
name: Manually promote prerelease to release
22

33
on:
44
workflow_dispatch:
55
inputs:
66
version:
77
description: 'Version to promote'
88
required: true
9-
version-bump:
10-
description: 'Version bump to apply - should usually match the version bump used for the prerelease since last release'
11-
required: true
12-
type: choice
13-
options:
14-
- 'patch'
15-
- 'minor'
16-
- 'major'
179

1810
jobs:
1911
manually_promote_release:
@@ -47,62 +39,71 @@ jobs:
4739
- name: Validate Gradle wrapper
4840
uses: gradle/wrapper-validation-action@v1
4941

50-
- name: Remove prerelease tag
51-
run: |
52-
echo "Removing prerelease tag from version"
53-
echo "VERSION=$(echo ${{ steps.get-release.outputs.tag_name }} | sed -E 's/-pre.*//')" >> $GITHUB_ENV
54-
55-
- name: Build
42+
- name: Build and test
5643
uses: gradle/gradle-build-action@v2
5744
with:
58-
arguments: clean build -x test -x checkstyleMain -x checkstyleTest
45+
arguments: clean build -x assemble -x shadowJar
5946
env:
6047
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
GITHUB_VERSION: ${{ env.VERSION }}
6248

6349
- name: Create release
6450
id: release
65-
uses: Multiverse/release-on-push-action@skip_prs
66-
env:
67-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
uses: benwoo1110/semantic-release-action@main
6852
with:
69-
bump_version_scheme: ${{ github.event.inputs.version-bump }}
70-
tag_prefix: ''
71-
release_name: "<RELEASE_VERSION>"
72-
use_github_release_notes: true
73-
ref: ${{ steps.get-release.outputs.target_commitish }}
74-
skip_prs: true
53+
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
version_bump: promote
55+
promote_from: ${{ github.event.inputs.version }}
7556

7657
- name: Publish package
7758
uses: gradle/gradle-build-action@v2
7859
with:
7960
arguments: publish
8061
env:
8162
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82-
GITHUB_VERSION: ${{ env.VERSION }}
63+
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
8364

8465
- name: Upload release artifact
8566
uses: svenstaro/upload-release-action@v2
8667
with:
8768
repo_token: ${{ secrets.GITHUB_TOKEN }}
88-
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
69+
file: build/libs/multiverse-core-${{ steps.release.outputs.publish_version }}.jar
8970
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
9071
tag: ${{ steps.release.outputs.tag_name }}
9172

92-
- name: Get Changelog
93-
id: changelog
94-
uses: cardinalby/[email protected]
95-
env:
96-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
- name: Download release artifact
74+
id: release-artifact
75+
uses: dsaltares/fetch-gh-release-asset@v1
9776
with:
98-
tag: ${{ steps.release.outputs.tag_name }}
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
version: tags/${{ steps.release.outputs.tag_name }}
79+
file: multiverse-core-${{ github.event.inputs.version }}.jar
9980

100-
- name: Modrinth Upload
81+
- name: Upload to modrinth.com
10182
uses: gradle/gradle-build-action@v2
10283
with:
10384
arguments: build modrinth
10485
env:
10586
GITHUB_VERSION: ${{ env.VERSION }}
10687
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
107-
CHANGELOG: ${{ steps.changelog.outputs.body }}
108-
PRERELEASE: ${{ steps.changelog.outputs.prerelease }}
88+
CHANGELOG: ${{ steps.release.outputs.body }}
89+
VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
90+
VERSION_TYPE: ${{ env.RELEASE_TYPE }}
91+
92+
- name: Upload to dev.bukkit.org
93+
uses: benwoo1110/[email protected]
94+
with:
95+
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
96+
project_id: 30765
97+
changelog: ${{ steps.release.outputs.body }}
98+
changelog_type: markdown
99+
display_name: ${{ steps.release.outputs.tag_name }}
100+
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
101+
release_type: ${{ env.RELEASE_TYPE }}
102+
project_relations: >
103+
[
104+
{"slug": "multiverse-portals", "type": "optionalDependency"},
105+
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
106+
{"slug": "multiverse-signportals", "type": "optionalDependency"},
107+
{"slug": "multiverse-inventories", "type": "optionalDependency"}
108+
]
109+
file_path: ${{ github.workspace }}/subdir/multiverse-core-${{ steps.release.outputs.tag_name }}.jar

.github/workflows/release.yml

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Validate Gradle wrapper
2020
uses: gradle/wrapper-validation-action@v1
2121

22-
- name: Test & Build
22+
- name: Build and test
2323
uses: gradle/gradle-build-action@v2
2424
with:
2525
arguments: clean build -x assemble -x shadowJar
@@ -28,55 +28,66 @@ jobs:
2828

2929
- name: Create release
3030
id: release
31-
uses: Multiverse/release-on-push-action@support_prerelease
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
uses: benwoo1110/semantic-release-action@main
3432
with:
35-
bump_version_scheme: norelease
36-
tag_prefix: ''
37-
release_name: "<RELEASE_VERSION>"
38-
use_github_release_notes: true
39-
40-
- name: Modify version scheme
41-
run: |
42-
if [[ "${{ steps.release.outputs.tag_name }}" == *"pre"* ]]; then
43-
echo "Replacing prerelease version scheme with SNAPSHOT"
44-
echo "VERSION=$(echo ${{ steps.release.outputs.tag_name }} | sed -E 's/-pre.*/-SNAPSHOT/')" >> $GITHUB_ENV
45-
else
46-
echo "Using release version scheme"
47-
echo "VERSION=${{ steps.release.outputs.tag_name }}" >> $GITHUB_ENV
48-
fi
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
34+
version_bump: prlabel
35+
release_mode: prerelease
4936

5037
- name: Publish package
38+
if: steps.release.outputs.release_created == 'true'
5139
uses: gradle/gradle-build-action@v2
5240
with:
5341
arguments: publish
5442
env:
55-
GITHUB_VERSION: ${{ env.VERSION }}
43+
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
5644
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5745

5846
- name: Upload release artifact
47+
if: steps.release.outputs.release_created == 'true'
5948
uses: svenstaro/upload-release-action@v2
6049
with:
6150
repo_token: ${{ secrets.GITHUB_TOKEN }}
62-
file: build/libs/multiverse-core-${{ env.VERSION }}.jar
51+
file: build/libs/multiverse-core-${{ steps.release.outputs.publish_version }}.jar
6352
asset_name: multiverse-core-${{ steps.release.outputs.tag_name }}.jar
6453
tag: ${{ steps.release.outputs.tag_name }}
6554

66-
- name: Get Changelog
67-
id: changelog
68-
uses: cardinalby/[email protected]
69-
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Download release artifact
56+
if: steps.release.outputs.release_created == 'true'
57+
uses: dsaltares/fetch-gh-release-asset@v1
7158
with:
72-
tag: ${{ steps.release.outputs.tag_name }}
59+
token: ${{ secrets.GITHUB_TOKEN }}
60+
version: tags/${{ steps.release.outputs.tag_name }}
61+
file: multiverse-core-${{ github.event.inputs.version }}.jar
7362

74-
- name: Modrinth Upload
63+
- name: Upload to modrinth.com
64+
if: steps.release.outputs.release_created == 'true'
7565
uses: gradle/gradle-build-action@v2
7666
with:
77-
arguments: build modrinth
67+
arguments: build modrinth -x checkstyleMain -x checkstyleTest
7868
env:
79-
GITHUB_VERSION: ${{ env.VERSION }}
69+
GITHUB_VERSION: ${{ steps.release.outputs.publish_version }}
8070
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
81-
CHANGELOG: ${{ steps.changelog.outputs.body }}
82-
PRERELEASE: ${{ steps.changelog.outputs.prerelease }}
71+
CHANGELOG: ${{ steps.release.outputs.body }}
72+
VERSION_NUMBER: ${{ steps.release.outputs.tag_name }}
73+
VERSION_TYPE: ${{ steps.release.outputs.release_type }}
74+
75+
- name: Upload to dev.bukkit.org
76+
if: steps.release.outputs.release_created == 'true'
77+
uses: benwoo1110/[email protected]
78+
with:
79+
api_token: ${{ secrets.DBO_UPLOAD_API_TOKEN }}
80+
project_id: 30765
81+
changelog: ${{ steps.release.outputs.body }}
82+
changelog_type: markdown
83+
display_name: ${{ steps.release.outputs.tag_name }}
84+
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
85+
release_type: ${{ steps.release.outputs.release_type }}
86+
project_relations: >
87+
[
88+
{"slug": "multiverse-portals", "type": "optionalDependency"},
89+
{"slug": "multiverse-netherportals", "type": "optionalDependency"},
90+
{"slug": "multiverse-signportals", "type": "optionalDependency"},
91+
{"slug": "multiverse-inventories", "type": "optionalDependency"}
92+
]
93+
file_path: ${{ github.workspace }}/multiverse-core-${{ steps.release.outputs.tag_name }}.jar

.github/workflows/require_label.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ jobs:
1515
with:
1616
mode: exactly
1717
count: 1
18-
labels: "release:major, release:minor, release:patch, no version bump"
18+
labels: "release:major, release:minor, release:patch, no release"

0 commit comments

Comments
 (0)