Skip to content

Commit ace9290

Browse files
committed
Provide phar download and document phar installation
1 parent b601645 commit ace9290

File tree

9 files changed

+3233
-6
lines changed

9 files changed

+3233
-6
lines changed

.github/actions/phar/action.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Build the PHAR'
2+
description: 'Build the PHAR for the current commit'
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Setup PHP
8+
uses: shivammathur/setup-php@v2
9+
with:
10+
php-version: '8.1'
11+
12+
- name: Install dependencies (lib)
13+
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --classmap-authoritative
14+
shell: bash
15+
16+
- name: Install dependencies (PHAR builder)
17+
run: composer install --prefer-dist --no-progress --optimize-autoloader --classmap-authoritative
18+
shell: bash
19+
working-directory: tools/phar
20+
21+
- name: Compile PHAR
22+
run: vendor/bin/box compile
23+
shell: bash
24+
working-directory: tools/phar
25+
26+
- name: Ensure PHAR is OK
27+
run: build/jolinotif.phar
28+
shell: bash
29+
working-directory: tools/phar

.github/workflows/build-phar.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build the PHAR
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
phar:
12+
name: Create a PHAR and upload it as an artifact
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Build the PHAR
19+
uses: ./.github/actions/phar
20+
21+
- name: Upload the PHAR
22+
uses: actions/upload-artifact@v3
23+
with:
24+
name: 'jolinotif'
25+
path: tools/phar/build/castor.phar
26+
if-no-files-found: error
File renamed without changes.

.github/workflows/release.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Attach PHAR to the release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
phar_release:
12+
name: Create a PHAR and upload it
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
18+
- name: Build the PHAR
19+
uses: ./.github/actions/phar
20+
21+
- name: Get release
22+
id: get_release
23+
uses: bruceadams/[email protected]
24+
env:
25+
GITHUB_TOKEN: ${{ github.token }}
26+
27+
- name: Upload release binary
28+
uses: actions/[email protected]
29+
env:
30+
GITHUB_TOKEN: ${{ github.token }}
31+
with:
32+
upload_url: ${{ steps.get_release.outputs.upload_url }}
33+
asset_path: ./tools/phar/build/jolinotif.phar
34+
asset_name: jolinotif.phar
35+
asset_content_type: application/octet-stream

doc/05-cli-usage.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
## Installation
44

5-
Install package globally:
5+
There is two ways to install JoliNotif for a CLI usage.
6+
7+
### Install package globally with Composer
68

79
```bash
810
$ composer global require jolicode/jolinotif
@@ -19,6 +21,15 @@ $ echo "export PATH=~/.composer/vendor/bin:$PATH" >> ~/.bashrc
1921
$ source ~/.bashrc
2022
```
2123

24+
### Download the PHAR executable
25+
26+
You can download the latest version of JoliNotif as a PHAR file from the [releases
27+
page](https://github.com/jolicode/JoliNotif/releases):
28+
29+
```bash
30+
curl https://github.com/jolicode/JoliNotif/releases/latest/download/jolinotif.phar && sudo mv jolinotif.phar /usr/local/bin/jolinotif
31+
```
32+
2233
## Usage
2334

2435
```bash

tools/phar/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor/
2+
/build/

box.json renamed to tools/phar/box.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
2-
"chmod": "0755",
2+
"base-path": "../../",
33
"directories": [
44
"bin",
5-
"example",
65
"src"
76
],
87
"files": [
@@ -21,7 +20,6 @@
2120
}
2221
],
2322
"git-version": "package_version",
24-
"main": "example/index.php",
25-
"output": "build/jolinotif.phar",
26-
"stub": true
23+
"main": "jolinotif",
24+
"output": "tools/phar/build/jolinotif.phar"
2725
}

tools/phar/composer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "jolicode/jolinotif-phar",
3+
"description": "Tooling for building JoliNotif PHAR",
4+
"type": "project",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Loïck Piera",
9+
"email": "[email protected]"
10+
}
11+
],
12+
"require": {
13+
"humbug/box": "^4.3.8",
14+
"humbug/php-scoper": "^0.18.3"
15+
},
16+
"config": {
17+
"optimize-autoloader": true,
18+
"preferred-install": "dist",
19+
"sort-packages": true
20+
}
21+
}

0 commit comments

Comments
 (0)