-
-
Notifications
You must be signed in to change notification settings - Fork 633
/
action.yaml
95 lines (86 loc) · 3.07 KB
/
action.yaml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: 'Hello World'
description: 'Greet someone'
inputs:
php-version:
description: "The PHP version to use when running the job"
required: true
php-extensions:
description: "The php extensions to install, allowing composer to pass"
required: true
key:
description: "The key to use for caching"
required: true
passphrase:
description: "The passphrase to use for signing"
required: true
secret-key:
description: "The secret key to use for signing"
required: true
token:
description: "Github token"
required: true
runs:
using: "composite"
steps:
- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.extensions }}
key: ${{ inputs.key }}
- name: Cache extensions
uses: actions/cache@v3
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
env:
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
with:
php-version: ${{ inputs.php-version }}
extensions: ${{ inputs.extensions }}
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1
tools: pecl
- name: Install Composer dependencies & cache dependencies
env:
COMPOSER_MIRROR_PATH_REPOS: 1
uses: "ramsey/composer-install@v2"
with:
composer-options: --optimize-autoloader
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
- name: remove phpstan/extension-installer
env:
COMPOSER_MIRROR_PATH_REPOS: 1
run: composer remove --dev phpstan/extension-installer
shell: bash
- name: Install Composer dependencies & cache dependencies
env:
COMPOSER_MIRROR_PATH_REPOS: 1
uses: "ramsey/composer-install@v2"
with:
composer-options: --optimize-autoloader
# Bust the cache at least once a month - output format: YYYY-MM-DD.
custom-cache-suffix: $(date -u -d "-0 month -$(($(date +%d)-1)) days" "+%F")
- name: warm cache
run: php bin/console cache:warmup --env=prod
shell: bash
- name: build phar
run: ./tools/box compile
shell: bash
- name: sign phar
# sign only when master or tags
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
env:
GPG_TTY: ${{ env.tty }}
shell: bash
run: |
echo "${{ inputs.secret-key }}" | gpg --import --batch --yes --passphrase "${{ inputs.passphrase }}"
gpg -K
#sign phar
echo "${{ inputs.passphrase }}" | gpg --command-fd 0 --pinentry-mode loopback -u info@phpdoc.org --batch --yes --output build/phpDocumentor.phar.asc --detach-sig build/phpDocumentor.phar
#verify signature
gpg --verify build/phpDocumentor.phar.asc build/phpDocumentor.phar