From bf802e28040fcfebb151ca54aafec1bd461545e4 Mon Sep 17 00:00:00 2001 From: SushilMallRC Date: Wed, 1 May 2024 17:18:55 +0530 Subject: [PATCH] refactor workflows --- .github/workflows/release-with-tag.yml | 39 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 15 ++-------- 2 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/release-with-tag.yml rename .github/workflows/{ci.yml => test.yml} (76%) diff --git a/.github/workflows/release-with-tag.yml b/.github/workflows/release-with-tag.yml new file mode 100644 index 00000000..3ae85a9a --- /dev/null +++ b/.github/workflows/release-with-tag.yml @@ -0,0 +1,39 @@ +name: Release + +on: + push: + tags: + - '*' +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: [8.1, 8.0, 7.4] + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Use PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: pcov + tools: composer:v2 + ini-values: phar.readonly=0 + - name: Composer update + run: composer update + - name: Install dependencies + run: composer install --prefer-dist --no-interaction + - name: Run tests + run: composer test + - name: Build phar + run: composer phar + - name: Release + if: matrix.php-version == '7.4' && startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: ./dist/ringcentral.phar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 76% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index 088d3a30..4a3873a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,5 @@ -name: CI Pipeline - +name: Test on: [push, pull_request] - -## Github Actions for PHP SDK - jobs: build: runs-on: ubuntu-latest @@ -36,11 +32,4 @@ jobs: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | composer global require php-coveralls/php-coveralls - php-coveralls --coverage_clover=dist/coverage/clover.xml -v - - name: Release - if: matrix.php-version == '7.4' && startsWith(github.ref, 'refs/tags/') - uses: softprops/action-gh-release@v1 - with: - files: ./dist/ringcentral.phar - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + php-coveralls --coverage_clover=dist/coverage/clover.xml -v \ No newline at end of file