Skip to content

Commit 70812b8

Browse files
ci: add release pipeline
1 parent 329aeba commit 70812b8

4 files changed

Lines changed: 199 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: Publish Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to release'
8+
required: true
9+
after-version:
10+
description: 'Snapshot version after release'
11+
required: true
12+
13+
jobs:
14+
set-release-version:
15+
uses: AlexProgrammerDE/PistonQueue/.github/workflows/set-version.yml@main
16+
with:
17+
version: ${{ inputs.version }}
18+
secrets: inherit
19+
20+
build:
21+
needs: set-release-version
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
ref: ${{ github.ref }}
30+
- name: Validate Gradle wrapper
31+
uses: gradle/actions/wrapper-validation@v4
32+
- name: Set up JDK 21
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: '21'
36+
distribution: 'temurin'
37+
- name: Setup Gradle
38+
uses: gradle/actions/setup-gradle@v4
39+
- name: Build with Gradle
40+
run: ./gradlew build test --stacktrace --scan
41+
42+
- name: Build Changelog
43+
id: github_release
44+
uses: mikepenz/release-changelog-builder-action@v5
45+
with:
46+
mode: COMMIT
47+
toTag: ${{ github.ref }}
48+
configurationJson: |
49+
{
50+
"template": "#{{CHANGELOG}}",
51+
"categories": [
52+
{
53+
"title": "## Feature",
54+
"labels": ["feat", "feature"]
55+
},
56+
{
57+
"title": "## Fix",
58+
"labels": ["fix", "bug"]
59+
},
60+
{
61+
"title": "## Performance",
62+
"labels": ["perf"]
63+
},
64+
{
65+
"title": "## Refactor",
66+
"labels": ["refactor"]
67+
},
68+
{
69+
"title": "## Documentation",
70+
"labels": ["docs"]
71+
},
72+
{
73+
"title": "## Build",
74+
"labels": ["build", "chore", "ci"]
75+
},
76+
{
77+
"title": "## Style",
78+
"labels": ["style"]
79+
},
80+
{
81+
"title": "## Test",
82+
"labels": ["test"]
83+
},
84+
{
85+
"title": "## Other",
86+
"labels": []
87+
}
88+
],
89+
"label_extractor": [
90+
{
91+
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
92+
"on_property": "title",
93+
"target": "$1"
94+
}
95+
]
96+
}
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- uses: Kir-Antipov/mc-publish@v3.3
101+
with:
102+
modrinth-id: pistonqueue
103+
modrinth-featured: true
104+
modrinth-unfeature-mode: subset
105+
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
106+
107+
github-tag: ${{ inputs.version }}
108+
github-generate-changelog: false
109+
github-draft: false
110+
github-prerelease: false
111+
github-commitish: main
112+
github-token: ${{ secrets.GITHUB_TOKEN }}
113+
114+
files: |
115+
build/libs/PistonQueue-${{ inputs.version }}-Velocity.jar
116+
build/libs/PistonQueue-${{ inputs.version }}-Bukkit.jar
117+
build/libs/PistonQueue-${{ inputs.version }}-Bungee.jar
118+
build/libs/PistonQueue-${{ inputs.version }}-Placeholder.jar
119+
120+
name: PistonQueue ${{ inputs.version }}
121+
version: ${{ inputs.version }}
122+
version-type: release
123+
changelog: ${{ steps.github_release.outputs.changelog }}
124+
125+
loaders: |
126+
bukkit
127+
bungeecord
128+
folia
129+
paper
130+
purpur
131+
spigot
132+
velocity
133+
waterfall
134+
game-versions: |
135+
>=1.8.0
136+
game-version-filter: releases
137+
java: |
138+
21
139+
140+
retry-attempts: 2
141+
retry-delay: 10000
142+
fail-mode: fail
143+
144+
- name: Discord Webhook Action
145+
uses: tsickert/discord-webhook@v7.0.0
146+
with:
147+
webhook-url: ${{ secrets.WEBHOOK_URL }}
148+
content: <@&850705047938793503> New PistonQueue version released!
149+
embed-title: PistonQueue ${{ inputs.version }}
150+
embed-description: PistonQueue ${{ inputs.version }} has been released! Changelog and download can be found at https://modrinth.com/plugin/pistonqueue/version/${{ inputs.version }}
151+
embed-color: 16641028
152+
embed-thumbnail-url: https://raw.githubusercontent.com/AlexProgrammerDE/PistonQueue/refs/heads/main/images/logo.png
153+
154+
set-after-version:
155+
needs: build
156+
uses: AlexProgrammerDE/PistonQueue/.github/workflows/set-version.yml@main
157+
with:
158+
version: ${{ inputs.after-version }}
159+
secrets: inherit

.github/workflows/set-version.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: set-version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to set'
8+
required: true
9+
workflow_call:
10+
inputs:
11+
version:
12+
required: true
13+
type: string
14+
15+
jobs:
16+
set-version:
17+
name: Set Version
18+
19+
permissions:
20+
contents: write
21+
22+
runs-on: ubuntu-24.04
23+
steps:
24+
- name: 'Shared: Checkout repository'
25+
uses: actions/checkout@v4
26+
with:
27+
ref: ${{ github.ref }}
28+
29+
- name: 'Set Version'
30+
run: |
31+
sed -i 's/^maven_version=.*/maven_version='"${{ inputs.version }}"'/g' gradle.properties
32+
33+
- name: 'Commit Version'
34+
uses: stefanzweifel/git-auto-commit-action@v5
35+
with:
36+
commit_message: 'chore(release): bump version to ${{ inputs.version }}'

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
allprojects {
66
group = "net.pistonmaster"
7-
version = "3.0.1-SNAPSHOT"
7+
version = property("maven_version")!!
88
description = "Best queue plugin out there!"
99
}
1010

gradle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# Gradle properties
22
org.gradle.daemon=true
33
org.gradle.configureondemand=true
4-
org.gradle.parallel=true
4+
org.gradle.parallel=true
5+
6+
maven_version=3.0.1-SNAPSHOT

0 commit comments

Comments
 (0)