Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/bedrocknexus-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Generated by BedrockNexus Plugins. Changes should be reviewed in a pull request.
name: BedrockNexus Publish

on:
push:
branches:
- "**"
tags:
- "v*"
pull_request:

permissions:
contents: read

concurrency:
group: bedrocknexus-publish-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Validate and package
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
tools: composer
- name: Validate PHP sources and dependencies
run: |
set -euo pipefail
find src -type f -name "*.php" -print0 | xargs -0 -n1 php -l
if [ -f composer.json ]; then composer validate --no-check-publish && composer install --no-interaction --no-progress --prefer-dist; fi
- name: Package PocketMine plugin
run: |
set -euo pipefail
mkdir -p dist
include_paths=(plugin.yml src)
for optional_path in resources vendor; do
if [ -e "${optional_path}" ]; then
include_paths+=("${optional_path}")
fi
done
include_csv=$(IFS=,; echo "${include_paths[*]}")
curl --fail --location --retry 3 \
https://github.com/pmmp/DevTools/releases/latest/download/DevTools.phar \
--output "${RUNNER_TEMP}/DevTools.phar"
php -dphar.readonly=0 "${RUNNER_TEMP}/DevTools.phar" \
--make "${include_csv}" \
--relative . \
--out "${RUNNER_TEMP}/BedrockNexusExample.phar"
mv "${RUNNER_TEMP}/BedrockNexusExample.phar" 'dist/BedrockNexusExample.phar'
test -s 'dist/BedrockNexusExample.phar'
- name: Upload validation artifact
uses: actions/upload-artifact@v4
with:
name: plugin-package
path: dist/BedrockNexusExample.phar
if-no-files-found: error

release:
name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download validated package
uses: actions/download-artifact@v4
with:
name: plugin-package
path: dist
- name: Publish GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "${GITHUB_REF_NAME}" dist/BedrockNexusExample.phar --generate-notes --verify-tag
Loading