-
Notifications
You must be signed in to change notification settings - Fork 192
73 lines (61 loc) · 2.01 KB
/
create_scoped_zip.yml
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
name: Create Release Zip
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none
- name: Install dependencies
run: composer install --no-dev --no-scripts --no-progress
- name: Install PHP-Scoper
run: |
composer global require humbug/php-scoper
echo "${HOME}/.composer/vendor/bin" >> $GITHUB_PATH
- name: Create scoper config
run: |
cat > scoper.inc.php <<EOF
<?php
return [
'prefix' => 'MollieVendor',
'finders' => [],
'exclude-namespaces' => ['Mollie\\Api'],
'exclude-files' => [],
];
EOF
- name: Scope dependencies
run: php-scoper add-prefix --output-dir=./build/scoped
- name: Setup autoloader
run: |
cd build/scoped
composer dump-autoload --classmap-authoritative
php examples/initialize.php
# Swap autoloader files to handle both scoped and non-scoped classes
mv vendor/autoload.php vendor/composer-autoload.php
sed -i.bak 's/autoload.php/composer-autoload.php/g' vendor/scoper-autoload.php
mv vendor/scoper-autoload.php vendor/autoload.php
rm vendor/*.bak
- name: Create release zip
run: |
cd build/scoped
zip -r ../../mollie-api-php-test.zip .
cd ../..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mollie-api-php-test
path: mollie-api-php-test.zip
# This step only runs on actual release
- name: Upload to release
if: github.event_name == 'release'
uses: JasonEtco/upload-to-release@master
with:
args: build/mollie-api-php.zip application/zip
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}