From ec16cce724248005c6b94414023fcac77986a9c7 Mon Sep 17 00:00:00 2001 From: ahung Date: Thu, 3 Feb 2022 16:54:01 -0700 Subject: [PATCH] Added deploy steps to build library release artifacts Added deploy steps that setup PHP, install prod dependencies, and bundle into a build artifact for release. Added commands to makefile to enable CI dependency install and bundling. Added build artifacts to .gitignore. --- .github/workflows/test-and-deploy.yml | 13 ++++++++++++- .gitignore | 3 +++ Makefile | 8 +++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 9d92985..885e115 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -53,8 +53,19 @@ jobs: - name: Checkout php-http-client uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@2.15.0 + with: + php-version: '7.4' + id: php + + - name: Build Release Artifacts + run: make bundle + - name: Create GitHub Release uses: sendgrid/dx-automator/actions/release@main + with: + assets: php-http-client.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -68,7 +79,7 @@ jobs: env: SLACK_COLOR: failure SLACK_ICON_EMOJI: ':github:' - SLACK_MESSAGE: ${{ format('Tests *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }} + SLACK_MESSAGE: ${{ format('Test *{0}*, Deploy *{1}*, {2}/{3}/actions/runs/{4}', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }} SLACK_TITLE: Action Failure - ${{ github.repository }} SLACK_USERNAME: GitHub Actions SLACK_MSG_AUTHOR: twilio-dx diff --git a/.gitignore b/.gitignore index c527c3a..9815053 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ vendor/ .php_cs .php_cs.cache phpunit.xml + +# Build artifacts +php-http-client.zip diff --git a/Makefile b/Makefile index 8fe298f..f14433b 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,16 @@ .PHONY: clean install test clean: - @rm -rf vendor composer.lock + @rm -rf vendor composer.lock php-http-client.zip + +ci-install: clean + composer install --no-dev install: clean composer install --no-suggest --no-scripts --no-progress --no-interaction test: install vendor/bin/phpunit test/unit + +bundle: ci-install + zip -r php-http-client.zip . -x \*.git\* \*composer.json\* \*test\*