Fixed Dockerfile (#1640) #29
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: | |
move-tag: | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) && contains(github.ref_name, 'master') | |
steps: | |
- name: Move ci tag | |
run: | | |
mkdir repo | |
git clone -b "$BRANCH_NAME" "https://github.com/${GITHUB_REPOSITORY}" repo | |
cd repo | |
bash .github/workflows/move-tag.sh "snapshot" "Last commit build by the CI" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
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@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for file changes | |
id: check-changed-files | |
uses: tj-actions/changed-files@v44 | |
- name: output list of changed files | |
run: echo ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }} | |
build-server: | |
name: Build PNX server | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
needs: [ move-tag, check-files ] | |
if: |# event is push and there is a change or push or commit the first message +b +u | |
(github.event_name == 'push' || | |
github.event.pull_request.head.repo.full_name != github.repository) && | |
(contains(needs.check-files.outputs.changed-files, 'src/') || | |
contains(needs.check-files.outputs.changed-files, '.github/workflows') || | |
(github.event_name == 'push' && | |
(contains(github.event.commits[0].message, '+b') || contains(github.event.commits[0].message, '+u')) | |
)) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
submodules: true | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- run: chmod +x gradlew | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-version: wrapper | |
cache-overwrite-existing: true | |
build-scan-publish: true | |
build-scan-terms-of-service-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-service-agree: "yes" | |
arguments: buildForGithubAction --scan | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v4.0.1 | |
if: success() && github.repository == 'PowerNukkitX/PowerNukkitX' && contains(github.ref_name, 'master') | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Read version | |
id: read_version | |
uses: christian-draeger/read-properties@1.1.1 | |
with: | |
path: 'build/resources/main/git.properties' | |
properties: 'git.build.version' | |
- name: Rename artifacts | |
run: | | |
cd build | |
ls | |
cd ../ | |
mv build/powernukkitx-${{ steps.read_version.outputs.git-build-version }}-all.jar build/powernukkitx-shaded.jar | |
tar -vczf build/libs.tar.gz build/libs | |
- name: Calculate hashes | |
run: | | |
cd build | |
mkdir -p hash/sha256 hash/md5 | |
sha256sum powernukkitx-shaded.jar > hash/sha256/powernukkitx-shaded.jar.sha256 | |
sha256sum powernukkitx.jar > hash/sha256/powernukkitx.jar.sha256 | |
sha256sum libs.tar.gz > hash/sha256/libs.tar.gz.sha256 | |
md5sum powernukkitx-shaded.jar > hash/md5/powernukkitx-shaded.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@v4 | |
if: success() | |
with: | |
name: PowerNukkitX-Core | |
path: build/powernukkitx.jar | |
- name: Archive Libraries | |
uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: PowerNukkitX-Libs | |
path: build/libs/ | |
- name: Archive PNX SHADED | |
uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: PowerNukkitX-Shaded | |
path: build/powernukkitx-shaded.jar | |
- name: Download PNX CLI | |
run: | | |
cd build | |
wget -O cli.jar https://github.com/PowerNukkitX/PNX-CLI/releases/download/0.2.4/PNX-CLI-0.2.4.jar | |
zip -q -r powernukkitx-run.zip powernukkitx.jar cli.jar libs | |
ls -l | |
- name: Release latest build | |
uses: Xotl/cool-github-releases@v1 | |
if: success() && github.repository == 'PowerNukkitX/PowerNukkitX' && contains(github.ref_name, 'master') | |
with: | |
mode: update | |
isPrerelease: false | |
tag_name: snapshot | |
release_name: "Latest Snapshot" | |
body_mrkdwn: | | |
This is the **latest version of PowerNukkitX**, built from the latest source. | |
(_Please note that the date on GitHub might appear outdated due to certain limitations._) | |
**Corresponding commit:** <https://github.com/powernukkitx/powernukkitx/commit/${{ github.sha }}>_ | |
> [!NOTE] | |
> If you encounter any issues, please report them directly on our [Discord](https://discord.gg/apwd7uauZg) or in the [GitHub Issues](https://github.com/powernukkitx/powernukkitx/issues) tab. | |
### How to Update | |
To update to the latest version, follow these steps: | |
1. Download the `powernukkitx.jar` file from the assets below. | |
2. Replace the `powernukkitx.jar` file in your server's directory with the new one. | |
3. Restart your server. | |
4. Enjoy the latest features and bug fixes ! | |
Thank you for using PowerNukkitX ⭐ | |
assets: build/powernukkitx-run.zip;build/powernukkitx.jar;build/libs.tar.gz;build/hash/sha256/powernukkitx.jar.sha256|text/plain;build/hash/sha256/libs.tar.gz.sha256|text/plain;build/hash/md5/powernukkitx.jar.md5|text/plain;build/hash/md5/libs.tar.gz.md5|text/plain; | |
replace_assets: true | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release new version | |
uses: ncipollo/release-action@v1 | |
if: success() && contains(github.event.commits[0].message, '+u') && github.repository == 'PowerNukkitX/PowerNukkitX' && contains(github.ref_name, 'master') | |
with: | |
artifacts: "build/powernukkitx-run.zip,build/powernukkitx.jar,build/libs.tar.gz,build/hash/sha256/powernukkitx.jar.sha256,build/hash/sha256/libs.tar.gz.sha256,build/hash/md5/powernukkitx.jar.md5,build/hash/md5/libs.tar.gz.md5" | |
tag: ${{ steps.read_version.outputs.git-build-version }} | |
body: ${{ steps.read_version.outputs.git-build-version }} - ${{ github.ref_name }} - ${{ github.sha }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit: ${{ github.ref_name }} | |
allowUpdates: true |