-
Notifications
You must be signed in to change notification settings - Fork 432
98 lines (78 loc) · 2.99 KB
/
phar.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
name: "Compile PHAR"
on:
push:
branches:
- "master"
env:
COMPOSER_ROOT_VERSION: "0.12.x-dev"
jobs:
compile:
name: "Compile PHAR"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "7.4"
tools: composer:v1
- name: "Cache dependencies"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-7.4-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-7.4-composer-"
- name: "Install dependencies"
run: "composer install --no-interaction --no-progress --no-suggest"
- name: "Install compiler dependencies"
run: "composer install --no-interaction --no-progress --no-suggest --working-dir=compiler"
- name: "Transform source code"
run: php bin/transform-source.php
- name: "Compile PHAR"
run: php compiler/bin/compile
- name: "Configure GPG signing key"
run: echo "$GPG_SIGNING_KEY" | base64 --decode | gpg --import --no-tty --batch --yes
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
- name: "Get Git log"
id: git-log
run: echo ::set-output name=log::$(git log ${{ github.event.before }}..${{ github.event.after }} --reverse --pretty='%H %s' | sed -e 's/^/https:\/\/github.com\/phpstan\/phpstan-src\/commit\//')
- name: "Checkout phpstan-dist"
uses: "actions/checkout@v2"
with:
repository: phpstan/phpstan
path: phpstan-dist
token: ${{ secrets.PAT }}
- name: "cp PHAR"
run: |
cp tmp/phpstan.phar phpstan-dist/phpstan.phar && \
cp tmp/phpstan.phar phpstan-dist/phpstan
- name: "Sign PHAR"
working-directory: phpstan-dist
run: rm phpstan.phar.asc && gpg --command-fd 0 --pinentry-mode loopback -u "$GPG_ID" --batch --detach-sign --output phpstan.phar.asc phpstan.phar
env:
GPG_ID: ${{ secrets.GPG_ID }}
- name: "Verify PHAR"
working-directory: phpstan-dist
run: "gpg --verify phpstan.phar.asc"
- name: "Set Git signing key"
working-directory: phpstan-dist
run: git config user.signingkey "$GPG_ID"
env:
GPG_ID: ${{ secrets.GPG_ID }}
- name: "Configure Git"
working-directory: phpstan-dist
run: |
git config user.email "ondrej@mirtes.cz" && \
git config user.name "Ondrej Mirtes"
- name: "Commit PHAR"
working-directory: phpstan-dist
run: |
git add phpstan phpstan.phar phpstan.phar.asc && \
git commit -S -m "Updated PHPStan to commit ${{ github.event.after }}" -m "${{ steps.git-log.outputs.log }}" && \
git push --quiet origin master