Merge pull request #4 from hametuha/wip/1.3.0 #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD for PHP Library | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
strategy: | |
matrix: | |
php: [ '7.4', '8.0', '8.1' ] # PHP versions to check. | |
wp: [ '5.9', 'latest' ] | |
name: UnitTest in WordPress ${{ matrix.wp }} and PHP ${{ matrix.php }} | |
uses: tarosky/workflows/.github/workflows/wp-unit-test.yml@main | |
with: | |
php_version: ${{ matrix.php }} | |
wp_version: ${{ matrix.wp }} | |
phpcs: | |
uses: tarosky/workflows/.github/workflows/phpcs.yml@main | |
with: | |
version: 7.2 | |
release: | |
name: Create Release Package | |
needs: [ test, phpcs ] | |
if: contains(github.ref, 'tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@master | |
- name: Setup PHP with composer v2 | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 7.2 | |
tools: composer | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clean Package | |
run: bash bin/cleanup.sh | |
- name: Zip Archive | |
run: zip -r ${{ github.event.repository.name }}.zip ./ | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload release asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ github.workspace }}/${{ github.event.repository.name }}.zip | |
asset_name: ${{ github.event.repository.name }}.zip | |
asset_content_type: application/zip |