Skip to content

Commit 2b466c0

Browse files
committed
CI: Add GitHub Action to auto-build PHAR
1 parent 573239c commit 2b466c0

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed

.github/workflows/build.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build LiteDocs PHAR
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
pull_request:
7+
branches: ['main']
8+
9+
jobs:
10+
build:
11+
name: Build PHAR
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
# 1. We retrieve the code
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
# 2. We install PHP 8.4
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.4'
24+
extensions: mbstring, intl, xml
25+
# We disable coverage to go faster
26+
coverage: none
27+
tools: composer:v2
28+
29+
# 3. We install the dependencies (including Box, which is in development)
30+
- name: Install Dependencies
31+
run: composer install --prefer-dist --no-progress
32+
33+
# 4. We launch the compilation via Box
34+
# We make sure that box.json is read correctly
35+
- name: Compile PHAR
36+
run: vendor/bin/box compile
37+
38+
# 5. We check that the file works (Smoke Test)
39+
- name: Test PHAR version
40+
run: |
41+
php litedocs.phar --version
42+
43+
# 6. We save the generated file so you can download it.
44+
- name: Upload Artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: litedocs-phar
48+
path: litedocs.phar
49+
retention-days: 5

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/vendor
2+
/vendor-bin
23
/site
34
/assets
45
.idea
56
.vscode
67
litedocs.phar
78
composer.lock
9+
/bin/litedocs.phar

box.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"main": "bin/litedocs",
3+
"output": "litedocs.phar",
4+
"directories": ["src", "themes", "config"],
5+
"files": ["composer.json"],
6+
"compression": "GZ",
7+
"chmod": "0755"
8+
}

composer.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
"bin/litedocs"
3131
],
3232
"config": {
33-
"sort-packages": true
33+
"sort-packages": true,
34+
"allow-plugins": {
35+
"bamarni/composer-bin-plugin": true
36+
}
37+
},
38+
"require-dev": {
39+
"bamarni/composer-bin-plugin": "^1.8"
40+
},
41+
"extra": {
42+
"bamarni-bin": {
43+
"bin-links": true,
44+
"forward-command": true
45+
}
3446
}
3547
}

0 commit comments

Comments
 (0)