Skip to content

Commit

Permalink
feat!: update to 1.21, rework payload registration
Browse files Browse the repository at this point in the history
  • Loading branch information
JustPyrrha committed Jul 20, 2024
1 parent 9b8d6c3 commit 12116b5
Show file tree
Hide file tree
Showing 38 changed files with 1,019 additions and 186 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@JustPyrrha
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "gradle"
directory: "/"
schedule:
interval: "weekly"
ignore:
- dependency-name: com.mojang:minecraft
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
1 change: 1 addition & 0 deletions .github/funding.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: JustPyrrha
154 changes: 154 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Build

on:
push:
branches:
- main

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
dependency-graph: generate-and-submit
artifact-retention-days: 1

- name: Set Gradle Wrapper Executable
run: chmod +x gradlew

- name: Build and Test
run: ./gradlew build test spotlessCheck

publish:
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'wanderia/netlib'
needs:
- build
permissions:
contents: write
pull-requests: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Set Gradle Wrapper Executable
run: chmod +x gradlew

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Prepare Changelog
id: changelog
run: |
CHANGELOG=$(./gradlew getChangelog --console=plain -q --no-header --no-summary --unreleased --no-empty-sections)
CHANGELOG="${CHANGELOG//$'\n'/'\\n'}"
CHANGELOG="${CHANGELOG//$'\r'/''}"
CHANGELOG=$(sed -E 's/Downloading https:\/\/services\.gradle\.org\/distributions\/gradle-[0-9\\.]*-bin\.zip\\\\n[\\.0-9%]*\\\\n//' <<< $CHANGELOG)
echo "changelog=$CHANGELOG" >> "$GITHUB_OUTPUT"
echo "# Changelog" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "$CHANGELOG" >> "$GITHUB_STEP_SUMMARY"
- name: Publish to Modrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew modrinth modrinthSyncBody

- name: Publish to GitHub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CHANGELOG="${{ steps.changelog.outputs.changelog }}"
NL=$'\n'
CHANGELOG=${CHANGELOG//$'\\n'/"${NL}"}
echo "$CHANGELOG" >> "notes.txt"
gh release create ${{ github.ref_name }} **/build/libs/**.jar --notes-file notes.txt
- name: Patch Changelog
run: ./gradlew patchChangelog

- name: Create Patched Changelog Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.ref_name }}"
BRANCH="changelog-patch/$VERSION"
git config user.email "github-actions@github.com"
git config user.name "github-actions"
git checkout -b $BRANCH
git add CHANGELOG.md
git commit -m "docs(changelog): patch changelog for $VERSION"
git push -u origin $BRANCH
gh pr create \
--title "docs(changelog): patch changelog for $VERSION" \
--body-file notes.txt \
--base main \
--head "$BRANCH"
- name: Build Documentation (DokkaHtml)
run: ./gradlew dokkaHtml

- name: Create Documentation Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.ref_name }}"
BRANCH="documentation-patch/$VERSION"
git config user.email "github-actions@github.com"
git config user.name "github-actions"
git checkout -b $BRANCH
git add docs/
git commit -m "docs(dokka): patch docs for $VERSION"
git push -u origin $BRANCH
gh pr create \
--title "docs(dokka): patch docs for $VERSION" \
--body "Adds published documentation for $VERSION" \
--base main \
--head "$BRANCH"
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload Dokka Artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs-publishing/

- name: Deploy Dokka Artifact to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
30 changes: 30 additions & 0 deletions .github/workflows/pullrequest-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build (Pull Request)

on:
pull_request:

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Validate Wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Set Gradle Wrapper Executable
run: chmod +x gradlew

- name: Build, Test, and Check
run: ./gradlew build test spotlessCheck
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.gradle/
.idea/
.kotlin/
build/
run/
docs-publishing/
runs/
*.iml
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- `wanderia-netlib` entrypoint as new standard for registering payload types.
- `WanderiaSerializersModule` used by default in payload serialization.
- `UUIDSerializer` as a default contextual serializer.
- `IdentifierSerialzier` as a default contextual serializer.
- Spotless formatting and checking.

### Changed
- Updated to Minecraft `1.21`
- Updated to Kotlin `2.0.0`
- Updated to Kotlinx Serialization `1.7.1`
- Updated to Fabric Loom `1.7-SNAPSHOT`
- Updated to Fabric Loader `0.16.0`
- Updated to Fabric API `0.100.7+1.21`

### Deprecated

### Removed
- `dev.wanderia.netlib.samples` has been replaced with a full example test mod in `src/testmod`.
- Yumi licenser (replaced by spotless)

### Fixed

### Security

## [1.0.0] - 2024-02-16

### Added
- Initial release
14 changes: 7 additions & 7 deletions HEADER
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Copyright (C) ${YEAR} Wanderia - All Rights Reserved

This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at https://mozilla.org/MPL/2.0/.

#type YEAR YEAR_LENIENT_RANGE
/*
* Copyright (C) 2024 Wanderia - All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
# netlib
Wanderia's networking utility library.
Kotlinx Serialization for Minecraft Payloads.

### Features
- Kotlinx Serialization encoder/decoder for Minecraft's FriendlyByteBuf/PacketByteBuf.
- Abstract `SerializedPacket` for easy packet creation.
- Abstract `SerializedPayload` for easy packet creation.

### Developer Usage
Usage samples can be found in the [`dev.wanderia.netlib.samples`](https://github.com/wanderia/netlib/tree/main/src/main/kotlin/dev/wanderia/netlib/sample/) package.\
This project is intended to be included via Jar-in-Jar.
netlib is available on the wanderia maven.
```kotlin
repositories {
maven("https://maven.wanderia.dev/releases") { name = "Wanderia" }
}
dependencies {
include("dev.wanderia:netlib:$version")
modImplementation("dev.wanderia:netlib:$version")
}
```
See the [testmod](src/testmod/) for example usage.

## Attribution
Logo icon by [Iconoir](https://iconoir.com/) which is licensed under MIT.
Binary file added artSrc/icon.afdesign
Binary file not shown.
14 changes: 14 additions & 0 deletions artSrc/logo-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 12116b5

Please sign in to comment.