Skip to content

Commit 3ceba68

Browse files
committed
API 3.0.0
1 parent c1642a2 commit 3ceba68

3 files changed

Lines changed: 97 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build and Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*'
8+
branches:
9+
- '**'
10+
pull_request:
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
build-maven:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Setup Java
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: 'temurin'
28+
java-version: '21'
29+
30+
- name: Build with Maven
31+
run: mvn -B package -DskipTests=false -Darguments="-Dmaven.javadoc.skip=true"
32+
33+
- name: Read project metadata
34+
id: project
35+
shell: bash
36+
run: |
37+
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
38+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
39+
FINAL_NAME=$(mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout)
40+
41+
echo "artifact_id=$ARTIFACT_ID" >> "$GITHUB_OUTPUT"
42+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
43+
echo "final_name=$FINAL_NAME" >> "$GITHUB_OUTPUT"
44+
echo "tag=v$VERSION" >> "$GITHUB_OUTPUT"
45+
echo "jar_path=target/$FINAL_NAME.jar" >> "$GITHUB_OUTPUT"
46+
47+
- name: Verify artifact
48+
shell: bash
49+
run: |
50+
if [ ! -f "${{ steps.project.outputs.jar_path }}" ]; then
51+
echo "${{ steps.project.outputs.jar_path }} was not created"
52+
exit 1
53+
fi
54+
55+
- name: Upload artifacts
56+
uses: actions/upload-artifact@v4
57+
if: success()
58+
with:
59+
name: ${{ steps.project.outputs.artifact_id }}
60+
path: ${{ steps.project.outputs.jar_path }}
61+
62+
- name: Create GitHub release
63+
if: github.event_name == 'push' && (github.ref_type == 'tag' || github.ref_name == github.event.repository.default_branch)
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
run: |
67+
if [ "${{ github.ref_type }}" = "tag" ]; then
68+
RELEASE_TAG="${{ github.ref_name }}"
69+
else
70+
RELEASE_TAG="${{ steps.project.outputs.tag }}"
71+
fi
72+
73+
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
74+
gh release upload "$RELEASE_TAG" "${{ steps.project.outputs.jar_path }}" --clobber
75+
else
76+
gh release create "$RELEASE_TAG" "${{ steps.project.outputs.jar_path }}" --target "${{ github.sha }}" --title "$RELEASE_TAG" --notes "Automated release for $RELEASE_TAG"
77+
fi

pom.xml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>org.powernukkitx.welcomemessage</groupId>
88
<artifactId>WelcomeMessage</artifactId>
9-
<version>1.0-SNAPSHOT</version>
9+
<version>1.0.1</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -17,9 +17,23 @@
1717
</properties>
1818

1919
<repositories>
20+
<repository>
21+
<id>central</id>
22+
<url>https://repo.maven.apache.org/maven2/</url>
23+
</repository>
2024
<repository>
2125
<id>jitpack.io</id>
22-
<url>https://jitpack.io</url>
26+
<url>https://www.jitpack.io</url>
27+
</repository>
28+
<repository>
29+
<id>opencollab-repository-maven-releases</id>
30+
<name>Opencollab Repository releases</name>
31+
<url>https://repo.opencollab.dev/maven-releases</url>
32+
</repository>
33+
<repository>
34+
<id>opencollab-repository-maven-snapshots</id>
35+
<name>Opencollab Repository snapshots</name>
36+
<url>https://repo.opencollab.dev/maven-snapshots</url>
2337
</repository>
2438
<repository>
2539
<id>PowerNukkitX-releases</id>
@@ -32,7 +46,7 @@
3246
<dependency>
3347
<groupId>org.powernukkitx</groupId>
3448
<artifactId>server</artifactId>
35-
<version>2.0.0-SNAPSHOT</version>
49+
<version>b-migration-SNAPSHOT</version>
3650
<scope>provided</scope>
3751
</dependency>
3852
<dependency>
@@ -44,6 +58,7 @@
4458
</dependencies>
4559

4660
<build>
61+
<finalName>WelcomeMessage</finalName>
4762
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
4863
<plugins>
4964
<plugin>

src/main/resources/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: WelcomeMessage
2-
version: 1.0.0
3-
api: 2.0.0
2+
version: ${pom.version}
3+
api: 3.0.0
44
main: org.powernukkitx.welcomemessage.WelcomeMessage
55
softdepend:
66
- PlaceholderAPI

0 commit comments

Comments
 (0)