Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #592 from jaoafa/mc1.18
Browse files Browse the repository at this point in the history
Minecraft / PaperMC 1.18への対応
  • Loading branch information
book000 authored Jan 16, 2022
2 parents 4ebd2f1 + 04fd08c commit 76ade9f
Show file tree
Hide file tree
Showing 13 changed files with 184 additions and 171 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/PaperServerTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: adopt

- name: Cache local Maven repository
Expand All @@ -30,4 +30,4 @@ jobs:
uses: jaoafa/[email protected]
with:
plugin-name: MyMaid4
minecraft-version: 1.16.5
minecraft-version: 1.18.1
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 11
java-version: 17
distribution: adopt

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B package --file pom.xml
6 changes: 6 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: adopt

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dependencies-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
- name: Create new branch
run: hub checkout -b dependencies-update-${{ steps.date.outputs.date }}

- name: Set up JDK 16
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 16
java-version: 17
distribution: adopt

- name: Cache local Maven repository
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/deploy.yml

This file was deleted.

132 changes: 132 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Release

on:
workflow_dispatch:
pull_request_target:
branches:
- main
types:
- closed

jobs:
release:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true

steps:
- name: Get current date
id: date
run: echo "::set-output name=datetime::$(date +'%Y%m%d-%H%M%S')"

- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: 17
distribution: adopt

- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Sed Version
run: |
sed -r -i '1,/version/s#<version>(.+?)</version>#<version>test</version>#' pom.xml
git diff
- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Set SHORT_SHA
id: vars
run: |
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)"
- name: Create a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.date.outputs.datetime }}
release_name: Release v${{ steps.date.outputs.datetime }}
draft: false
prerelease: true
body: |
${{ github.event.pull_request.body }}
jaoweb sha: [${{ steps.jaoweb-vars.outputs.SHORT_SHA }}](https://github.com/jaoafa/jaoweb/commit/${{ steps.jaoweb-vars.outputs.SHORT_SHA }})
jaoweb-docs sha: ${{ steps.docs-vars.outputs.SHORT_SHA }}
- name: Upload Release Asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: target/MyMaid4.jar
asset_name: MyMaid4.jar
asset_content_type: application/zip

- name: Released comment
uses: actions/github-script@v4
with:
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `# リリースが完了しました\n\n${{ steps.create_release.outputs.html_url }}`
})
deploy:
runs-on: ubuntu-latest
needs: release
if: github.event.pull_request.merged == true

steps:
- name: Deploy
id: deployRequest
uses: fjogeleit/http-request-action@master
with:
url: ${{ secrets.DEPLOY_URL }}
method: 'POST'
bearerToken: ${{ secrets.DEPLOY_KEY }}
ignoreStatusCodes: '500'
timeout: 600000

- name: Show Response
run: echo ${{ steps.deployRequest.outputs.response }}

- name: Is Successful Deploy
if: ${{ fromJson(steps.deployRequest.outputs.response).status == 'SUCCESSFUL' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :white_check_mark: デプロイが完了しました
プルリクエストがマージされたため、本番環境へのデプロイを行いました。
バージョンは `${{ fromJson(steps.deployRequest.outputs.response).version }}` です。稼働中バージョンの確認は Minecraft サーバ内で `/ver MyMaid4` を実行することで確認できます。
反映は本番環境の再起動後ですので、アクティブログインユーザーの同意を得て再起動するか、3時の自動再起動を待ってください。
- name: Is Failed Deploy
if: ${{ fromJson(steps.deployRequest.outputs.response).status == 'ERROR' }}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
# :x: デプロイに失敗しました
プルリクエストがマージされたため、本番環境へのデプロイを行おうとしましたが失敗しました。
エラー内容は以下の通りです。
```
${{ fromJson(steps.deployRequest.outputs.response).type }} (${{ fromJson(steps.deployRequest.outputs.response).type_ja }}) - ${{ fromJson(steps.deployRequest.outputs.response).status }} (${{ fromJson(steps.deployRequest.outputs.response).status_ja }})
${{ fromJson(steps.deployRequest.outputs.response).message }}
```
17 changes: 0 additions & 17 deletions .run/ReBuild And Reload (Mac).run.xml

This file was deleted.

27 changes: 15 additions & 12 deletions .run/ReBuild And Reload (Win).run.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="ReBuild And Reload (Win)" type="ShConfigurationType" singleton="false">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="false" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/.run/buildAndTest.bat" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<envs />
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="MyMaid4 build" run_configuration_type="MavenRunConfiguration" />
</method>
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/.run/buildAndTest.bat"/>
<option name="SCRIPT_OPTIONS" value=""/>
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true"/>
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
<option name="INDEPENDENT_INTERPRETER_PATH" value="true"/>
<option name="INTERPRETER_PATH" value=""/>
<option name="INTERPRETER_OPTIONS" value=""/>
<option name="EXECUTE_IN_TERMINAL" value="true"/>
<option name="EXECUTE_SCRIPT_FILE" value="true"/>
<envs/>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="MyMaid4 build"
run_configuration_type="MavenRunConfiguration"/>
</method>
</configuration>
</component>
10 changes: 5 additions & 5 deletions .run/buildAndTest.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if not exist server\plugins (
)

if not exist server\paper.jar (
curl -o server\paper.jar -L "https://papermc.io/api/v1/paper/1.16.5/latest/download"
curl -o server\paper.jar -L "https://api.tomacheese.com/papermc/1.18.1/latest"
)

if not exist server\mcrconapi-1.1.1.jar (
Expand Down Expand Up @@ -56,9 +56,9 @@ if %errorlevel% == 0 (
set SELECTED_JAVA=java
)

where java11 2>nul
where java17 2>nul
if %errorlevel% == 0 (
set SELECTED_JAVA=java11
set SELECTED_JAVA=java17
)

if %SELECTED_JAVA% == "notfound" (
Expand All @@ -73,8 +73,8 @@ for /f tokens^=2-5^ delims^=-_^" %%j in ('%SELECTED_JAVA% -fullversion 2^>^&1')

echo Java Version: %JAVA_VERSION% (%JAVA_VERSION:~0,3%)

if /i not "%JAVA_VERSION:~0,3%" == "11." (
echo Paperサーバの起動にはJava 11が必要です
if /i not "%JAVA_VERSION:~0,3%" == "17." (
echo Paperサーバの起動にはJava 17が必要です

echo 5秒後にクローズします。
timeout 5 /NOBREAK
Expand Down
Loading

0 comments on commit 76ade9f

Please sign in to comment.