2021-01-11 19:16:44 +01:00
|
|
|
name: Build phar
|
|
|
|
|
2021-01-11 19:27:58 +01:00
|
|
|
on:
|
2021-02-11 19:52:10 +01:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-01-11 19:16:44 +01:00
|
|
|
release:
|
|
|
|
types:
|
|
|
|
- published
|
|
|
|
|
2022-09-02 20:16:42 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-01-11 19:16:44 +01:00
|
|
|
jobs:
|
2021-04-04 05:59:40 +02:00
|
|
|
pre_job:
|
2022-09-02 20:16:42 +02:00
|
|
|
permissions:
|
|
|
|
actions: write
|
2021-04-04 05:59:40 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
|
|
|
steps:
|
|
|
|
- id: skip_check
|
2023-10-23 09:36:44 +02:00
|
|
|
uses: fkirc/skip-duplicate-actions@v5.3.1
|
2021-04-04 05:59:40 +02:00
|
|
|
with:
|
|
|
|
concurrent_skipping: always
|
|
|
|
cancel_others: true
|
2021-06-23 00:04:19 +02:00
|
|
|
do_not_skip: '["release"]'
|
2021-04-04 05:59:40 +02:00
|
|
|
# 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"]'
|
|
|
|
|
2021-01-11 19:16:44 +01:00
|
|
|
build-phar:
|
2022-09-02 20:16:42 +02:00
|
|
|
permissions:
|
|
|
|
contents: write # for release
|
2021-04-04 05:59:40 +02:00
|
|
|
needs: pre_job
|
|
|
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
|
2021-01-11 19:16:44 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set up PHP
|
|
|
|
uses: shivammathur/setup-php@v2
|
|
|
|
with:
|
|
|
|
php-version: '7.4'
|
|
|
|
tools: composer:v2
|
2021-11-29 07:07:14 +01:00
|
|
|
coverage: none
|
2023-03-12 06:45:23 +01:00
|
|
|
env:
|
|
|
|
fail-fast: true
|
2021-01-11 19:16:44 +01:00
|
|
|
|
2023-09-11 09:29:32 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-12-23 22:26:39 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0 # required for composer to automatically detect root package version
|
2021-01-11 19:16:44 +01:00
|
|
|
|
|
|
|
- name: Get Composer Cache Directories
|
|
|
|
id: composer-cache
|
|
|
|
run: |
|
2023-02-09 08:35:58 +01:00
|
|
|
echo "files_cache=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
|
|
|
|
echo "vcs_cache=$(composer config cache-vcs-dir)" >> $GITHUB_OUTPUT
|
2021-01-11 19:16:44 +01:00
|
|
|
|
2023-03-12 07:01:01 +01:00
|
|
|
- name: Generate composer.lock
|
|
|
|
run: |
|
|
|
|
composer update --no-install
|
|
|
|
|
2021-01-11 19:16:44 +01:00
|
|
|
- name: Cache composer cache
|
2024-01-22 08:14:10 +01:00
|
|
|
uses: actions/cache@v4
|
2021-01-11 19:16:44 +01:00
|
|
|
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
|
2022-12-23 22:26:39 +01:00
|
|
|
# DO NOT set this, we need composer to figure out the version itself
|
|
|
|
# env:
|
|
|
|
# COMPOSER_ROOT_VERSION: dev-master
|
2021-01-11 19:16:44 +01:00
|
|
|
|
|
|
|
- run: bin/build-phar.sh
|
|
|
|
env:
|
2021-01-11 20:37:17 +01:00
|
|
|
GPG_SIGNING: 1
|
2021-01-11 21:15:14 +01:00
|
|
|
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
|
|
|
|
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
|
2021-01-11 19:16:44 +01:00
|
|
|
|
|
|
|
- name: Upload release assets
|
2021-02-11 19:52:10 +01:00
|
|
|
if: ${{ github.event_name == 'release' }}
|
2021-01-11 19:16:44 +01:00
|
|
|
uses: svenstaro/upload-release-action@v2
|
|
|
|
with:
|
|
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
file: build/psalm.phar*
|
|
|
|
file_glob: true
|
|
|
|
tag: ${{ github.ref }}
|
2021-02-11 19:46:45 +01:00
|
|
|
|
|
|
|
- name: Release psalm/phar
|
2021-02-11 19:47:19 +01:00
|
|
|
run: bin/github-deploy-phar.sh
|
2021-02-11 19:59:52 +01:00
|
|
|
env:
|
|
|
|
PHAR_REPO_TOKEN: ${{ secrets.PHAR_REPO_TOKEN }}
|
|
|
|
|