Update adamraichu.auto-accept-custom-launch-args #2
Workflow file for this run
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: Test Build | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
workflow_dispatch: | |
jobs: | |
test-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Install Dependencies | |
run: | | |
pnpm install | |
env: | |
NODE_ENV: production | |
- name: Build Plugin | |
run: | | |
pnpm run build | |
env: | |
NODE_ENV: production | |
- name: Prepare Distribution Files | |
run: | | |
mkdir -p dist | |
cp -r ".millennium" dist/.millennium 2>/dev/null || echo "::error::.millennium directory not found, it is required to run the plugin." | |
cp "plugin.json" dist/plugin.json 2>/dev/null || { echo "::error::plugin.json was not found. It is required for plugins to have."; exit 1; } | |
cp "requirements.txt" dist/requirements.txt 2>/dev/null || echo "::warning::requirements.txt not found, skipping." | |
cp "README.md" dist/README.md 2>/dev/null || echo "::warning::README.md not found, skipping." | |
cp "README" dist/README 2>/dev/null || echo "::warning::README not found, skipping." | |
BACKEND_DIR=$(jq -r '.backend' plugin.json) | |
if [ "$BACKEND_DIR" != "null" ]; then | |
cp -r "$BACKEND_DIR" ./dist/"$BACKEND_DIR" | |
else | |
cp -r "backend" ./dist/backend 2>/dev/null || echo "::warning::backend directory not found, skipping." | |
fi | |
FRONTEND_DIR=$(jq -r '.frontend' plugin.json) | |
if [ "$FRONTEND_DIR" != "null" ]; then | |
cp -r "$FRONTEND_DIR" ./dist/"$FRONTEND_DIR" | |
else | |
cp -r "frontend" ./dist/frontend 2>/dev/null || echo "::warning::frontend directory not found, skipping." | |
fi | |
include=$(jq -r '.include // [] | .[]' plugin.json) | |
if [ -z "$include" ]; then | |
echo "::notice::No additional files to include." | |
else | |
echo "::notice::Including additional files: $include" | |
for item in $include; do | |
mkdir -p "./dist/$(dirname "$item")" | |
cp -r "./$item" "./dist/$item" | |
done | |
fi | |
echo "::notice::Computing plugin metadata..." | |
echo "{\"commit\": \"$(git rev-parse HEAD)\", \"id\": \"$(git rev-list --max-parents=0 HEAD)\"}" > dist/metadata.json | |
id=$(jq -r '.id' dist/metadata.json) | |
cd dist | |
echo "::notice::Building plugin archive..." | |
zip -r build.zip . | |
echo "::notice::Successfully built plugin." | |
- name: Upload Plugin | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: dist/build.zip | |