Skip to content

Commit

Permalink
Add Phar build process through GitHub actions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehplague authored Dec 12, 2019
1 parent 8086281 commit 4666bbd
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 9 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: phar build

on: [push]

jobs:
analysis:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Run PHPStan
run: composer phpstan

build:
runs-on: ubuntu-latest

needs:
- analysis

steps:
- uses: actions/checkout@v1

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: '7.3'
extensions: ctype, intl, json, mbstring, mysqli, pdo
coverage: none

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: |
sed -i "s#^MAILER_DSN=.*\$#MAILER_DSN=${{ secrets.MAILER_DSN }}#" .env
composer install --prefer-dist --no-progress --no-dev --optimize-autoloader
composer dump-env prod
bin/console cache:clear
bin/console cache:warmup
- name: Build phar
uses: docker://php:7.3-cli-alpine3.10
with:
args: "/bin/sh -c \"apk --no-cache add git && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer && curl -LO https://github.com/humbug/box/releases/download/3.8.3/box.phar && mv box.phar /usr/local/bin/box && chmod +x /usr/local/bin/box && box compile && chmod 755 pwmgr.phar\""

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release phar
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./pwmgr.phar
asset_name: pwmgr.phar
asset_content_type: application/octet-stream
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
Expand Down
78 changes: 70 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions symfony.lock
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@
"tests/.gitignore"
]
},
"symfony/polyfill-ctype": {
"version": "v1.13.1"
},
"symfony/polyfill-intl-idn": {
"version": "v1.12.0"
},
Expand Down

0 comments on commit 4666bbd

Please sign in to comment.