Skip to content

Commit 0c3cc07

Browse files
Add deployment
1 parent ce692ba commit 0c3cc07

6 files changed

Lines changed: 125 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repository
12+
uses: actions/checkout@v4
13+
14+
- name: Cache Gradle dependencies
15+
uses: actions/cache@v4
16+
with:
17+
path: ~/.gradle
18+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
19+
restore-keys: |
20+
${{ runner.os }}-gradle-
21+
22+
- name: Setup Java
23+
uses: actions/setup-java@v2
24+
with:
25+
distribution: 'adopt'
26+
java-version: '25'
27+
28+
- name: Modify gradlew permissions
29+
run: chmod +x ./gradlew
30+
31+
- name: Build server
32+
run: ./gradlew :origami-server:shadowJar
33+
34+
- name: Write version to file
35+
run: ./gradlew printVersion -q > deployment/VERSION
36+
37+
- name: Inject channel into config
38+
run: |
39+
CHANNEL=$(./gradlew printChannel -q)
40+
sed -i "s/\$CHANNEL/$CHANNEL/g" deployment/config.json
41+
42+
- name: Inject minecraft version into config
43+
run: |
44+
MINECRAFT_VERSION=$(./gradlew printMinecraftVersion -q)
45+
sed -i "s/\$MINECRAFT_VERSION/$MINECRAFT_VERSION/g" deployment/config.json
46+
47+
- name: Get last commit SHA and message
48+
id: last_commit
49+
run: |
50+
{
51+
echo "commit_sha=$(git rev-parse --short HEAD)"
52+
echo "commit_msg<<EOF"
53+
git log -1 --pretty=%B
54+
echo "EOF"
55+
} >> "$GITHUB_OUTPUT"
56+
57+
- name: Deploy
58+
uses: fancyinnovations/fancyverteiler@main
59+
with:
60+
config_path: "/deployment/config.json"
61+
github_repo_url: "https://github.com/origamimc/origami"
62+
commit_sha: ${{ steps.last_commit.outputs.commit_sha }}
63+
commit_message: ${{ steps.last_commit.outputs.commit_msg }}
64+
fancyspaces_api_key: ${{ secrets.FANCYSPACES_API_KEY }}
65+
discord_webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
66+
67+
- name: Publish to maven releases repo
68+
run: ./gradlew :origami-api:publishMavenPublicationToFancyspacesReleasesRepository
69+
env:
70+
FANCYSPACES_API_KEY: ${{ secrets.FANCYSPACES_API_KEY }}
71+
72+
- name: Publish to maven snapshots repo
73+
run: ./gradlew :origami-api:publishMavenPublicationToFancyspacesSnapshotsRepository
74+
env:
75+
FANCYSPACES_API_KEY: ${{ secrets.FANCYSPACES_API_KEY }}

build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,27 @@ allprojects {
1111
maven(url = "https://jitpack.io")
1212
}
1313
}
14+
15+
tasks.register("printVersion") {
16+
group = "origami"
17+
18+
doLast {
19+
print(project.version)
20+
}
21+
}
22+
23+
tasks.register("printChannel") {
24+
group = "origami"
25+
26+
doLast {
27+
print(project.properties["channel"])
28+
}
29+
}
30+
31+
tasks.register("printMinecraftVersion") {
32+
group = "origami"
33+
34+
doLast {
35+
print(project.properties["minecraftVersion"])
36+
}
37+
}

deployment/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Commit hash: %COMMIT_HASH%
2+
3+
Commit message: %COMMIT_MESSAGE%
4+
5+
*(The last commit message does not always directly reflect the changes related to this version.)*
6+
7+
Keep in mind that this is a snapshot version. Snapshot versions are **not** meant to be used in production. They are for **testing purposes only** and may contain bugs or incomplete features. Use at your own risk.

deployment/VERSION

Whitespace-only changes.

deployment/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"project_name": "Origami",
3+
"plugin_jar_path": "/origami-server/build/libs/Origami-%VERSION%.jar",
4+
"changelog_path": "/deployment/CHANGELOG.md",
5+
"version_path": "/deployment/VERSION",
6+
"fancyspaces": {
7+
"space_id": "D74ncT77",
8+
"platform": "executable",
9+
"channel": "$CHANNEL",
10+
"supported_versions": [
11+
"$MINECRAFT_VERSION"
12+
]
13+
}
14+
}

origami-server/build.gradle.kts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,17 @@ plugins {
33
id("com.gradleup.shadow")
44
}
55

6+
sourceSets {
7+
create("minecraft") { }
8+
}
9+
610
dependencies {
711
implementation(project(":origami-api"))
12+
// implementation(sourceSets["minecraft"].output)
813

914
implementation("org.jetbrains:annotations:26.1.0")
1015
}
1116

12-
sourceSets {
13-
create("minecraft") {
14-
15-
}
16-
}
17-
1817
tasks {
1918
shadowJar {
2019
archiveClassifier.set("")

0 commit comments

Comments
 (0)