File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,55 @@ jobs:
1515 - name : Checkout
1616 uses : actions/checkout@v4
1717
18+ - name : Setup PHP
19+ uses : shivammathur/setup-php@v2
20+ with :
21+ php-version : ' 8.1'
22+ tools : composer
23+
24+ - name : Generate phar archive
25+ run : |
26+ # Install dependencies
27+ composer install --no-dev --optimize-autoloader
28+
29+ # Create phar build script
30+ cat > build-phar.php << 'EOF'
31+ <?php
32+ $version = str_replace('v', '', getenv('GITHUB_REF_NAME') ?: '0.0.0');
33+ $pharFile = 'invoicetronic-sdk-' . $version . '.phar';
34+
35+ if (file_exists($pharFile)) {
36+ unlink($pharFile);
37+ }
38+
39+ $phar = new Phar($pharFile);
40+ $phar->startBuffering();
41+
42+ // Add all necessary files
43+ $phar->buildFromDirectory(__DIR__, '/\.(php|json)$/');
44+
45+ // Set stub
46+ $phar->setStub('<?php
47+ require_once "phar://" . __FILE__ . "/vendor/autoload.php";
48+ __HALT_COMPILER();');
49+
50+ $phar->stopBuffering();
51+
52+ echo "Phar archive created: $pharFile\n";
53+ EOF
54+
55+ # Build the phar
56+ php build-phar.php
57+
58+ # Verify the phar was created
59+ ls -la *.phar
60+
1861 - name : Create Release
1962 uses : softprops/action-gh-release@v2
2063 with :
2164 generate_release_notes : true
2265 make_latest : true
66+ files : |
67+ *.phar
2368 env :
2469 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments