Initial commit
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
# 📌 Pull Request
|
||||
|
||||
## Description
|
||||
|
||||
<!--
|
||||
Provide a clear and concise summary of what this PR does.
|
||||
Explain *why* the change is needed and what problem it solves.
|
||||
-->
|
||||
|
||||
## Related Issues / Discussions
|
||||
|
||||
<!--
|
||||
Link any related issues, PRs, or discussions.
|
||||
Use "Fixes #123" to automatically close issues when merged.
|
||||
-->
|
||||
|
||||
- Fixes #
|
||||
- Related to #
|
||||
|
||||
## Motivation & Context
|
||||
|
||||
<!--
|
||||
Why is this change important for Project Poseidon?
|
||||
Does it fix a bug, improve stability, add a feature, or improve compatibility?
|
||||
-->
|
||||
|
||||
## Type of Change
|
||||
|
||||
Please tick all that apply:
|
||||
|
||||
- [ ] 🐛 Bug fix (non-breaking change that fixes an issue)
|
||||
- [ ] ⚡ Performance improvement
|
||||
- [ ] 🧩 New feature (non-breaking)
|
||||
- [ ] 🔧 Refactor / cleanup (no functional changes)
|
||||
- [ ] 🔥 Crash / exploit fix
|
||||
- [ ] 📚 Documentation update
|
||||
- [ ] ❗ Breaking change (may affect plugins or server behavior)
|
||||
|
||||
## Testing Performed
|
||||
|
||||
<!--
|
||||
Describe how this change was tested.
|
||||
Include environments, steps, and results.
|
||||
-->
|
||||
|
||||
- [ ] Compiled successfully with `mvn clean package`
|
||||
- [ ] Tested on a Beta 1.7.3 server
|
||||
- [ ] Existing functionality verified
|
||||
- [ ] Edge cases considered
|
||||
|
||||
**Test details:**
|
||||
```text
|
||||
Example:
|
||||
- Local server with multiple players
|
||||
- Testing on production environment on RetroMC
|
||||
- Tested login, chunk loading, plugins, and shutdown
|
||||
```
|
||||
|
||||
## Logs / Screenshots (if applicable)
|
||||
|
||||
<!-- Paste relevant log output, stack traces, or attach screenshots to help reviewers understand the change. -->
|
||||
|
||||
```(Optional)```
|
||||
|
||||
## Compatibility Considerations
|
||||
|
||||
<!-- Does this change affect: Plugins? Network behavior? UUID / inventory handling? Other? -->
|
||||
|
||||
- [ ] No known compatibility impact
|
||||
- [ ] Potential plugin impact (described below)
|
||||
- [ ] Network / protocol (Netcode) behavior changed
|
||||
- [ ] Configuration change required
|
||||
|
||||
|
||||
## Compatibility Notes
|
||||
|
||||
<!-- Describe any known compatibility risks or required changes if applicable. -->
|
||||
|
||||
## Checklist
|
||||
|
||||
Please confirm the following:
|
||||
- [ ] No unnecessary formatting or whitespace-only changes
|
||||
- [ ] Changes are compatible with Minecraft Beta 1.7.3
|
||||
- [ ] No dependencies have been added without discussion with the RetroMC team
|
||||
|
||||
## Additional Notes
|
||||
<!-- Anything else reviewers should know? Design decisions, limitations, future follow-ups, etc. -->
|
||||
|
||||
|
||||
|
||||
## Thanks for contributing to Project Poseidon!
|
||||
@@ -0,0 +1,101 @@
|
||||
name: build-and-test
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# Step 1: Checkout the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Step 2: Set up JDK 1.8
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 8
|
||||
|
||||
# Step 3: Get the version from pom.xml
|
||||
- name: Get the version from pom.xml
|
||||
id: get_version
|
||||
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
|
||||
|
||||
# Step 4: Generate custom release version
|
||||
- name: Generate Release Version
|
||||
id: release_version
|
||||
run: |
|
||||
DATE=$(date +'%y%m%d-%H%M')
|
||||
SHA=$(echo $GITHUB_SHA | cut -c1-7)
|
||||
RELEASE_VERSION="${PROJECT_VERSION}-${DATE}-${SHA}"
|
||||
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
|
||||
|
||||
# Step 5: Create version.properties file
|
||||
- name: Create version.properties file
|
||||
run: |
|
||||
mkdir -p src/main/resources
|
||||
|
||||
# Application Information
|
||||
APP_NAME=$(mvn help:evaluate -Dexpression=project.name -q -DforceStdout)
|
||||
|
||||
# Core Metadata
|
||||
echo "version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties
|
||||
echo "build_timestamp=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')" >> src/main/resources/version.properties
|
||||
echo "git_branch=${{ github.ref_name }}" >> src/main/resources/version.properties
|
||||
echo "git_commit=${GITHUB_SHA}" >> src/main/resources/version.properties
|
||||
|
||||
echo "app_name=${APP_NAME}" >> src/main/resources/version.properties
|
||||
echo "release_version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties
|
||||
echo "maven_version=${{ env.PROJECT_VERSION }}" >> src/main/resources/version.properties
|
||||
|
||||
# Build Type
|
||||
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ github.ref }}" == "refs/heads/main" ]]; then
|
||||
BUILD_TYPE="production"
|
||||
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||
BUILD_TYPE="pull_request"
|
||||
else
|
||||
BUILD_TYPE="development"
|
||||
fi
|
||||
echo "build_type=${BUILD_TYPE}" >> src/main/resources/version.properties
|
||||
|
||||
# CI/CD Metadata
|
||||
echo "workflow_name=${{ github.workflow }}" >> src/main/resources/version.properties
|
||||
echo "workflow_run_id=${{ github.run_id }}" >> src/main/resources/version.properties
|
||||
echo "workflow_run_number=${{ github.run_number }}" >> src/main/resources/version.properties
|
||||
|
||||
# Team or Author Information
|
||||
echo "build_author=${{ github.actor }}" >> src/main/resources/version.properties
|
||||
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v4.5
|
||||
with:
|
||||
maven-version: 3.9.1
|
||||
|
||||
# Step 6: Build application
|
||||
- name: Build Application
|
||||
shell: bash
|
||||
run: |
|
||||
mvn clean install
|
||||
|
||||
# Step 7: Run Tests
|
||||
- name: Run Tests
|
||||
shell: bash
|
||||
run: |
|
||||
mvn test
|
||||
|
||||
# Step 8: Upload artifact
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.repository.name }}-artifact
|
||||
path: target/*.jar
|
||||
@@ -0,0 +1,39 @@
|
||||
name: Java-Compatibility
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
# Java 8 is tested as a part of the build-and-test workflow
|
||||
java-version: ['17', '21' ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Java ${{ matrix.java-version }}
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: ${{ matrix.java-version }}
|
||||
distribution: temurin
|
||||
java-package: jdk
|
||||
|
||||
- name: Set up Maven
|
||||
uses: stCarolas/setup-maven@v4.5
|
||||
with:
|
||||
maven-version: 3.9.1
|
||||
|
||||
- name: Build application
|
||||
shell: bash
|
||||
run: |
|
||||
mvn clean install
|
||||
@@ -0,0 +1,112 @@
|
||||
name: Release Workflow
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up JDK 8
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: "8"
|
||||
cache: maven
|
||||
|
||||
- name: Get Maven project version
|
||||
id: get_version
|
||||
run: echo "PROJECT_VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Fail if snapshot version
|
||||
run: |
|
||||
if [[ "$PROJECT_VERSION" == *"-SNAPSHOT"* ]]; then
|
||||
echo "Snapshot versions are not releasable: $PROJECT_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Generate Release Version
|
||||
run: |
|
||||
DATE=$(date +'%y%m%d-%H%M')
|
||||
SHA=$(echo "$GITHUB_SHA" | cut -c1-7)
|
||||
RELEASE_VERSION="${PROJECT_VERSION}-${DATE}-${SHA}"
|
||||
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_ENV"
|
||||
echo "Release version: $RELEASE_VERSION"
|
||||
|
||||
- name: Set Maven version to Release Version (no commit)
|
||||
run: |
|
||||
mvn -B versions:set -DnewVersion="${RELEASE_VERSION}" -DgenerateBackupPoms=false
|
||||
|
||||
- name: Create version.properties
|
||||
run: |
|
||||
mkdir -p src/main/resources
|
||||
|
||||
APP_NAME=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.name)
|
||||
|
||||
{
|
||||
echo "version=${RELEASE_VERSION}"
|
||||
echo "build_timestamp=$(date --utc +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
echo "git_branch=${GITHUB_REF_NAME}"
|
||||
echo "git_commit=${GITHUB_SHA}"
|
||||
echo "app_name=${APP_NAME}"
|
||||
echo "release_version=${RELEASE_VERSION}"
|
||||
echo "maven_version=${RELEASE_VERSION}"
|
||||
|
||||
if [[ "$GITHUB_REF" == "refs/heads/master" || "$GITHUB_REF" == "refs/heads/main" ]]; then
|
||||
BUILD_TYPE="production"
|
||||
else
|
||||
BUILD_TYPE="development"
|
||||
fi
|
||||
echo "build_type=${BUILD_TYPE}"
|
||||
|
||||
echo "workflow_name=${GITHUB_WORKFLOW}"
|
||||
echo "workflow_run_id=${GITHUB_RUN_ID}"
|
||||
echo "workflow_run_number=${GITHUB_RUN_NUMBER}"
|
||||
echo "build_author=${GITHUB_ACTOR}"
|
||||
} > src/main/resources/version.properties
|
||||
|
||||
- name: Write Maven settings.xml for Nexus auth
|
||||
run: |
|
||||
mkdir -p ~/.m2
|
||||
cat > ~/.m2/settings.xml << 'EOF'
|
||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
|
||||
<servers>
|
||||
<server>
|
||||
<id>johnymuffin-nexus</id>
|
||||
<username>${env.NEXUS_USERNAME}</username>
|
||||
<password>${env.NEXUS_PASSWORD}</password>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
EOF
|
||||
env:
|
||||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
|
||||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
||||
|
||||
- name: Build & Deploy to Nexus
|
||||
run: mvn -B -DskipTests clean deploy
|
||||
env:
|
||||
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
|
||||
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
|
||||
|
||||
- name: Create GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ env.RELEASE_VERSION }}
|
||||
name: ${{ env.RELEASE_VERSION }}
|
||||
files: |
|
||||
target/*.jar
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user