-
-
Notifications
You must be signed in to change notification settings - Fork 660
91 lines (79 loc) · 2.84 KB
/
publish.yml
File metadata and controls
91 lines (79 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Publish to npm
on:
workflow_dispatch:
inputs:
package:
description: "Package to publish"
required: true
type: choice
options:
- melonjs
- debug-plugin
- tiled-inflate-plugin
- spine-plugin
- create-melonjs
dry-run:
description: "Dry run (skip actual publish)"
required: false
type: boolean
default: false
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
environment: npm
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
- uses: pnpm/action-setup@v5
- name: Install dependencies
run: pnpm install
- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps chromium
- name: Lint & check
run: |
pnpm lint
pnpm biome check
- name: Set package directory
id: pkg
run: |
if [ "${{ inputs.package }}" = "melonjs" ]; then
echo "dir=packages/melonjs" >> "$GITHUB_OUTPUT"
echo "build_cmd=pnpm dist" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.package }}" = "debug-plugin" ]; then
echo "dir=packages/debug-plugin" >> "$GITHUB_OUTPUT"
echo "build_cmd=pnpm clean && pnpm build" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.package }}" = "tiled-inflate-plugin" ]; then
echo "dir=packages/tiled-inflate-plugin" >> "$GITHUB_OUTPUT"
echo "build_cmd=pnpm clean && pnpm build" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.package }}" = "spine-plugin" ]; then
echo "dir=packages/spine-plugin" >> "$GITHUB_OUTPUT"
echo "build_cmd=pnpm clean && pnpm build" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.package }}" = "create-melonjs" ]; then
echo "dir=packages/create-melonjs" >> "$GITHUB_OUTPUT"
echo "build_cmd=echo 'No build step needed'" >> "$GITHUB_OUTPUT"
fi
- name: Build & test
working-directory: ${{ steps.pkg.outputs.dir }}
run: ${{ steps.pkg.outputs.build_cmd }}
- name: Publish to npm
if: ${{ !inputs.dry-run }}
working-directory: ${{ steps.pkg.outputs.dir }}
run: npm publish --access=public --provenance
- name: Publish (dry run)
if: ${{ inputs.dry-run }}
working-directory: ${{ steps.pkg.outputs.dir }}
run: npm publish --access=public --dry-run
- name: Create GitHub release
if: ${{ !inputs.dry-run && inputs.package == 'melonjs' }}
run: pnpm tsx scripts/release.ts ${{ inputs.package }}
env:
GH_TOKEN: ${{ github.token }}