-
Notifications
You must be signed in to change notification settings - Fork 661
96 lines (83 loc) · 2.83 KB
/
build-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
name: Build phar
on:
push:
branches:
- master
release:
types:
- published
permissions:
contents: read
jobs:
pre_job:
permissions:
actions: write
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
concurrent_skipping: always
cancel_others: true
do_not_skip: '["release"]'
# list files that may affect or are included into the built phar
paths: '["bin/**", "assets/**", "build/**", "dictionaries/**", "src/**", "stubs/**", "psalm", "psalm-language-server", "psalm-plugin", "psalm-refactor", "psalter", "box.json.dist", "composer.json", "config.xsd", "keys.asc.gpg", "scoper.inc.php"]'
build-phar:
permissions:
contents: write # for release
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2
coverage: none
env:
fail-fast: true
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for composer to automatically detect root package version
- name: Get Composer Cache Directories
id: composer-cache
run: |
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
- name: Generate composer.lock
run: |
composer update --no-install
- name: Cache composer cache
uses: actions/cache@v4
with:
path: |
${{ steps.composer-cache.outputs.files_cache }}
${{ steps.composer-cache.outputs.vcs_cache }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Run composer install
run: composer install -o
# DO NOT set this, we need composer to figure out the version itself
# env:
# COMPOSER_ROOT_VERSION: dev-master
- run: bin/build-phar.sh
env:
GPG_SIGNING: 1
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Upload release assets
if: ${{ github.event_name == 'release' }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: build/psalm.phar*
file_glob: true
tag: ${{ github.ref }}
- name: Release psalm/phar
run: bin/github-deploy-phar.sh
env:
PHAR_REPO_TOKEN: ${{ secrets.PHAR_REPO_TOKEN }}