Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
#	src/main/java/dev/waterdog/waterdogpe/command/Command.java
#	src/main/java/dev/waterdog/waterdogpe/command/defaults/SendCommand.java
#	src/main/java/dev/waterdog/waterdogpe/command/defaults/ServerCommand.java
#	src/main/java/dev/waterdog/waterdogpe/network/protocol/ProtocolConstants.java
#	src/main/java/dev/waterdog/waterdogpe/network/protocol/ProtocolVersion.java
#	src/main/java/dev/waterdog/waterdogpe/network/protocol/codec/BedrockCodec448.java
#	src/main/java/dev/waterdog/waterdogpe/network/protocol/user/HandshakeUtils.java
  • Loading branch information
Kaooot committed Nov 23, 2023
2 parents 8c31b63 + b8ff958 commit 38070e5
Show file tree
Hide file tree
Showing 239 changed files with 7,208 additions and 5,912 deletions.
73 changes: 73 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "build"
description: "Default WDPE build action"

inputs:
repo_token:
description: "GitHub secret token"
required: true
perform_deploy:
description: "Whether to deploy to maven repository"
required: true
deploy_repository:
description: "The maven repository name to deploy"
required: true
deploy_username:
description: "A username to access maven repository"
required: true
deploy_password:
description: "A password of a maven repository user"
required: true
create_prerelease:
description: "Create a pre release build"
required: true
prerelease_name:
description: "A name of pre-release"
required: false
default: "latest"

runs:
using: "composite"
steps:
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt-hotspot

- name: Setup maven repo
uses: s4u/[email protected]
if: ${{ inputs.perform_deploy == 'true' }}
with:
servers: |
[{
"id": "${{ inputs.deploy_repository }}",
"username": "${{ inputs.deploy_username }}",
"password": "${{ inputs.deploy_password }}"
}]
- name: Build
if: ${{ inputs.perform_deploy == 'false' }}
run: mvn -B package --file pom.xml
shell: bash

- name: Build and Deploy
if: ${{ inputs.perform_deploy == 'true' }}
run: mvn -B package deploy --file pom.xml
shell: bash

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: waterdog
path: target/Waterdog.jar

- name: Create pre-release
if: ${{ inputs.create_prerelease == 'true' }}
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ inputs.repo_token }}"
automatic_release_tag: "${{ inputs.prerelease_name }}"
prerelease: true
title: "Snapshot Build"
files: |
target/Waterdog.jar
86 changes: 49 additions & 37 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,59 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Build and Publish

name: Maven Build

on: [ push ]
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
branches:
- '**'

jobs:
build:
env:
DOCKER_DEPLOY: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/waterdog-2' }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt-hotspot
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: waterdog
path: target/Waterdog.jar
- name: Upload pre-release
if: github.ref == 'refs/heads/master'
uses: "marvinpinto/action-automatic-releases@latest"
- name: Checkout
uses: actions/checkout@v2

- name: Build
uses: ./.github/actions/build
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Snapshot Build"
files: |
target/Waterdog.jar
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v2
perform_deploy: ${{ env.DOCKER_DEPLOY }}
deploy_repository: "waterdog-snapshots"
deploy_username: ${{ secrets.DEPLOY_USERNAME }}
deploy_password: ${{ secrets.DEPLOY_PASSWORD }}
create_prerelease: ${{ github.ref == 'refs/heads/master' }}
prerelease_name: "latest"

- name: Docker Login
uses: docker/login-action@v1
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
username: waterdogpe
password: ${{ secrets.docker_pat }}
- name: Publish Docker latest
if: github.ref == 'refs/heads/master'
uses: docker/[email protected]
images: "ghcr.io/${{ github.repository }}"
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Docker build and push
uses: docker/build-push-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' && github.event_name != 'pull_request' }}
with:
context: ./
push: true
tags: waterdogpe/waterdogpe:latest
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 17 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Pull Request Check

on: [pull_request]

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

- name: Build and verify
uses: ./.github/actions/build
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
perform_deploy: false
create_prerelease: false
58 changes: 38 additions & 20 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release build
name: Release Build
on:
push:
tags:
Expand All @@ -7,34 +7,52 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Startup
- name: Checkout
uses: actions/checkout@v2
- name: Set up Java 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt-hotspot
- name: Build with Maven

- name: Set version to release
run: |
sed -i -e s/#build/"release"/g ./src/main/java/dev/waterdog/waterdogpe/VersionInfo.java
mvn -B install --file pom.xml
- name: Create Release
- name: Build
uses: ./.github/actions/build
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
perform_deploy: true
deploy_repository: "waterdog-releases"
deploy_username: ${{ secrets.DEPLOY_USERNAME }}
deploy_password: ${{ secrets.DEPLOY_PASSWORD }}
create_prerelease: false # Use custom release step

- name: Create release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "Release ${{ github.ref }} by ${{ github.actor }}"
files: |
target/Waterdog.jar
- name: Login to DockerHub
uses: docker/login-action@v2
- name: Docker Login
uses: docker/login-action@v1
with:
username: waterdogpe
password: ${{ secrets.docker_pat }}
- name: Publish Docker release
uses: docker/[email protected]
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
context: ./
push: true
tags: waterdogpe/waterdogpe:release,waterdogpe/waterdogpe:${{ github.ref }}
images: "ghcr.io/${{ github.repository }}"
tags: |
type=semver,pattern={{version}}
type=raw,value=release
- name: Docker build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
57 changes: 0 additions & 57 deletions Jenkinsfile

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ To compile WaterdogPE please visit our [COMPILING.md](COMPILING.md) guide.
<repositories>
<repository>
<id>waterdog-repo</id>
<url>https://repo.waterdog.dev/artifactory/main</url>
<url>https://repo.waterdog.dev/main</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>dev.waterdog.waterdogpe</groupId>
<artifactId>waterdog</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit 38070e5

Please sign in to comment.