fix: memory leak #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PowerNukkitX | |
on: [push,pull_request] | |
jobs: | |
check-files: | |
name: Check repository files | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) | |
outputs: | |
changed-files: ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }} | |
steps: | |
- name: Check out repository contents | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check for file changes | |
id: check-changed-files | |
uses: tj-actions/[email protected] | |
- name: output list of changed files | |
run: echo ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }} | |
build-server: | |
name: Build PNX server | |
runs-on: ubuntu-latest | |
needs: check-files | |
# event为push且发生改变或push或commit第一条信息+b +u | |
# event is push and there is a change or push or commit the first message +b +u | |
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && (contains(needs.check-files.outputs.changed-files, 'src/') || (github.event_name == 'push' && (contains(github.event.commits[0].message, '+b') || contains(github.event.commits[0].message, '+u')))) | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
submodules: true | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 17 | |
- name: Build with Maven | |
run: mvn -B package -DskipTests=false -Darguments="-Dmaven.javadoc.skip=true" | |
- name: Get version | |
id: getVersion | |
uses: entimaniac/[email protected] | |
- name: Rename artifacts | |
run: | | |
cd target | |
ls | |
cd ../ | |
mv target/powernukkitx-${{ steps.getVersion.outputs.version }}-shaded.jar target/powernukkitx-full.jar | |
mv target/powernukkitx-${{ steps.getVersion.outputs.version }}.jar target/powernukkitx.jar | |
tar -vczf target/libs.tar.gz target/libs | |
- name: Calculate hashes | |
run: | | |
cd target | |
mkdir -p hash/sha256 hash/md5 | |
sha256sum powernukkitx-full.jar > hash/sha256/powernukkitx-full.jar.sha256 | |
sha256sum powernukkitx.jar > hash/sha256/powernukkitx.jar.sha256 | |
sha256sum libs.tar.gz > hash/sha256/libs.tar.gz.sha256 | |
md5sum powernukkitx-full.jar > hash/md5/powernukkitx-full.jar.md5 | |
md5sum powernukkitx.jar > hash/md5/powernukkitx.jar.md5 | |
md5sum libs.tar.gz > hash/md5/libs.tar.gz.md5 | |
- name: Archive PNX Core | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: PowerNukkitX-Core | |
path: target/powernukkitx.jar | |
- name: Archive PNX Full | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: PowerNukkitX-Full | |
path: target/powernukkitx-full.jar | |
- name: Archive Libraries | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: PowerNukkitX-Libs | |
path: target/libs/ | |
- name: Archive Hashes | |
uses: actions/upload-artifact@v3 | |
if: success() | |
with: | |
name: Hashes(md5 & sha256) | |
path: target/hash/ | |
- name: Get Short SHA | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- uses: ncipollo/release-action@v1 | |
name: Release new version | |
if: success() && contains(github.event.commits[0].message, '+u') && github.repository == 'PowerNukkitX/PowerNukkitX' && contains(github.ref_name, 'master') | |
with: | |
artifacts: "target/powernukkitx.jar,target/libs.tar.gz,target/hash/sha256/powernukkitx.jar.sha256,target/hash/sha256/libs.tar.gz.sha256,target/hash/md5/powernukkitx.jar.md5,target/hash/md5/libs.tar.gz.md5" | |
tag: ${{ steps.getVersion.outputs.version }} | |
body: ${{ steps.getVersion.outputs.version }} - ${{ github.ref_name }} - ${{ steps.vars.outputs.sha_short }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit: ${{ github.ref_name }} | |
allowUpdates: true | |
- name: Upload to OSS | |
uses: tvrcgo/[email protected] | |
if: github.event_name == 'push' && github.repository == 'PowerNukkitX/PowerNukkitX' && (!contains(github.ref_name, 'patch')) && (!contains(github.ref_name, 'feature')) | |
with: | |
key-id: ${{ secrets.OSS_KEY_ID }} | |
key-secret: ${{ secrets.OSS_KEY_SECRET }} | |
region: oss-cn-hongkong | |
bucket: pnx-assets | |
asset-path: ./target/powernukkitx.jar | |
target-path: /core/${{ github.ref_name }}-${{ steps.vars.outputs.sha_short }}/ | |
- name: Get Time | |
id: time | |
uses: nanzm/[email protected] | |
if: github.repository == 'PowerNukkitX/PowerNukkitX' && (!contains(github.ref_name, 'patch')) && (!contains(github.ref_name, 'feature')) | |
with: | |
timeZone: 8 | |
format: 'YYYY/MM/DD-HH:mm:ss' | |
- name: Format ChangeLog | |
uses: mkungla/actions-set-text-output@v1 | |
id: get-changelog | |
if: success() && github.event_name == 'push' && github.repository == 'PowerNukkitX/PowerNukkitX' && (!contains(github.ref_name, 'patch')) && (!contains(github.ref_name, 'feature')) | |
with: | |
text: ${{ github.event.commits[0].message }} | |
- name: Update MineBBS infomation | |
uses: fjogeleit/http-request-action@v1 | |
if: success() && github.event_name == 'push' && github.repository == 'PowerNukkitX/PowerNukkitX' && (!contains(github.ref_name, 'patch')) && (!contains(github.ref_name, 'feature')) | |
with: | |
url: 'https://api.minebbs.com/api/openapi/v1/resources/3668/update' | |
method: 'POST' | |
customHeaders: '{"Authorization": "Bearer ${{ secrets.MINEBBS_API_KEY }}"}' | |
contentType: 'application/json' | |
data: '{"title": "${{ github.ref_name }}-${{ steps.vars.outputs.sha_short }}", "description": "${{ steps.get-changelog.outputs.value }}", "new_version": "${{ steps.time.outputs.time }}", "file_url": "https://ci.lt-name.cn/job/PowerNukkitX/"}' | |
escapeData: 'true' | |
preventFailureOnNoResponse: 'true' | |
ignoreStatusCodes: '400,404,401,403,500,502,503,504' | |
# build-bootstrap: | |
# name: 构建启动器 | |
# runs-on: ubuntu-latest | |
# needs: check-files | |
# if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && (contains(needs.check-files.outputs.changed-files, 'Bootstrap/src/') || (github.event_name == 'push' && contains(github.event.commits[0].message, '+b'))) | |
# | |
# steps: | |
# - uses: actions/checkout@v1 | |
# with: | |
# submodules: true | |
# - uses: actions/cache@v1 | |
# with: | |
# path: ~/.m2/repository | |
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
# restore-keys: | | |
# ${{ runner.os }}-maven- | |
# - name: Set up JDK 17 | |
# uses: actions/setup-java@v1 | |
# with: | |
# java-version: 17 | |
# - name: Build with Maven | |
# run: mvn -B -f Bootstrap/pom.xml package -DskipTests=false -Darguments="-Dmaven.javadoc.skip=true" | |
# - name: Rename artifacts | |
# run: mv Bootstrap/target/Bootstrap-*-shaded.jar Bootstrap/target/bootstrap.jar | |
# - name: Archive artifacts | |
# uses: actions/upload-artifact@v3 | |
# if: success() | |
# with: | |
# name: PowerNukkitX-bootstrap | |
# path: Bootstrap/target/bootstrap.jar | |
# - name: Get Short SHA | |
# id: vars | |
# run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
# - name: Upload to OSS | |
# uses: tvrcgo/[email protected] | |
# if: github.event_name == 'push' && github.repository == 'PowerNukkitX/PowerNukkitX' && (!contains(github.ref_name, 'patch')) && (!contains(github.ref_name, 'feature')) | |
# with: | |
# key-id: ${{ secrets.OSS_KEY_ID }} | |
# key-secret: ${{ secrets.OSS_KEY_SECRET }} | |
# region: oss-cn-hongkong | |
# bucket: pnx-assets | |
# asset-path: ./Bootstrap/target/bootstrap.jar | |
# target-path: /bootstrap/${{ github.ref_name }}-${{ steps.vars.outputs.sha_short }}/ |