Skip to content

Commit

Permalink
Enhance Github Workflow and Deploy Github Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ekojs committed May 16, 2022
1 parent abad206 commit 7c485ed
Showing 1 changed file with 61 additions and 19 deletions.
80 changes: 61 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
name: Release Deployment

on:
pull_request:
push:
tags:
- v**
# pull_request:
# branches: [ master ]

permissions:
contents: write

jobs:
build:

runs-on: ubuntu-latest
name: ${{ matrix.operating-system }} - PHP ${{ matrix.php-versions }}
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.3', '7.4', '8.0', '8.1']

steps:
- uses: actions/checkout@v3

- name: Setup PHP with PCOV
id: setup-php
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
ini-values: pcov.directory=src
php-version: "${{ matrix.php-versions }}"
extensions: intl
coverage: pcov

- name: Validate composer.json and composer.lock
Expand All @@ -33,16 +38,33 @@ jobs:
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-php-${{ steps.setup-php.outputs.php-version }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-${{ github.repository }}
${{ runner.os }}-php-${{ steps.setup-php.outputs.php-version }}-
- name: Install dependencies
run: composer install

- name: Run test suite
run: composer run test


- shell: bash
run: |
which tar && tar -czvf coverage.tar.gz build/logs/html
- name: Upload coverage as artifacts
uses: actions/upload-artifact@v3
with:
name: mycoverage_${{ runner.os }}_${{ matrix.php-versions }}
path: coverage.tar.gz

release:
name: Release tag
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Create Release
id: create-new-release
uses: actions/create-release@v1
Expand All @@ -52,20 +74,40 @@ jobs:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
## [2.0.0] - 2022-05-16
## [2.0.1] - 2022-05-17
### Add
- Add Verify function
- Set Custom Client for easy to mock
- Unit Test using PHPUnit
- Add Code Coverage
- Add Github pages for pcov coverage
### Update
- Get Authorization
- Callback
- Refresh Token
- Github Workflow
### Delete
- Cookie Function
draft: false
prerelease: false

deploy:
name: Deploy Github Pages
needs: release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Download coverage
uses: actions/download-artifact@v3
with:
name: mycoverage_Linux_7.3

- shell: bash
run: |
which tar && tar -xzvf coverage.tar.gz && cd build/logs/html && mv _js js && mv _css css && mv _icons icons && for x in $(grep . -irle '_js');do sed -i'' 's/_js/js/g' $x;done && for x in $(grep . -irle '_css');do sed -i'' 's/_css/css/g' $x;done && for x in $(grep . -irle '_icons');do sed -i'' 's/_icons/icons/g' $x;done
- name: List files in the repository
run: |
ls ${{ github.workspace }}/build/logs/html
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: build/logs/html

0 comments on commit 7c485ed

Please sign in to comment.