Skip to content

Commit fe73773

Browse files
committed
DD#main: build: add build workflow
1 parent 553c8cb commit fe73773

File tree

6 files changed

+100
-1
lines changed

6 files changed

+100
-1
lines changed

.github/workflows/build.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
release:
8+
types: [ created ]
9+
jobs:
10+
build-phar:
11+
runs-on: ubuntu-latest
12+
name: Build PHAR
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 7.4
23+
ini-values: phar.readonly=0, display_errors=On, error_reporting=-1
24+
tools: composer:v2
25+
coverage: none
26+
27+
- name: Get composer cache directory
28+
id: composercache
29+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
30+
31+
- name: Cache composer dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: ${{ steps.composercache.outputs.dir }}
35+
key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('composer.*') }}
36+
restore-keys: |
37+
composer-${{ runner.os }}-${{ matrix.php }}-
38+
composer-${{ runner.os }}-
39+
composer-
40+
41+
- name: Install dependencies
42+
run: composer install --no-interaction --no-progress --prefer-dist
43+
44+
- name: Build PHAR
45+
run: |
46+
curl -LSs https://box-project.github.io/box2/installer.php | php
47+
./box.phar build
48+
49+
- uses: actions/upload-artifact@v1
50+
name: Upload the PHAR artifact
51+
with:
52+
name: magegen.phar
53+
path: bin/magegen.phar
54+
publish-phar:
55+
runs-on: ubuntu-latest
56+
name: Publish the PHAR
57+
needs:
58+
- build-phar
59+
if: github.event_name == 'release'
60+
steps:
61+
- uses: actions/download-artifact@v1
62+
with:
63+
name: magegen.phar
64+
path: .
65+
66+
- name: Upload magegen.phar
67+
uses: actions/upload-release-asset@v1
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
with:
71+
upload_url: ${{ github.event.release.upload_url }}
72+
asset_path: magegen.phar
73+
asset_name: magegen.phar
74+
asset_content_type: application/zip

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
/public/bundles/
88
/var/
99
/vendor/
10+
!.gitkeep
11+
bin
1012
###< symfony/framework-bundle ###

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ Symfony console based M2 code generation tool.
44

55
## Installation
66

7+
### Clone the repository
8+
79
```
810
git clone https://github.com/Skywire/MageGen.git magegen
911
cd magegen
1012
composer install
1113
chmod +x magegen.php
1214
```
1315

16+
### Download the phar
17+
18+
```
19+
curl -o magegen.phar https://github.com/Skywire/MageGen/releases/latest/download/magegen.phar
20+
chmod +x magegen.phar
21+
sudo mv magegen.phar /usr/local/bin/magegen
22+
```
23+
1424
## Usage
1525

1626
### Commands

bin/.gitkeep

Whitespace-only changes.

box.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"chmod": "0755",
3+
"main": "magegen.php",
4+
"output": "bin/magegen.phar",
5+
"directories": ["src", "templates"],
6+
"finder": [
7+
{
8+
"name": "*.php",
9+
"exclude": ["test", "tests"],
10+
"in": "vendor"
11+
}
12+
],
13+
"stub": true
14+
}

magegen.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env php
21
<?php
32

43
/**

0 commit comments

Comments
 (0)