Skip to content

Commit

Permalink
up: update the php and release action
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Nov 2, 2022
1 parent 14d623d commit 74a9075
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 32 deletions.
37 changes: 37 additions & 0 deletions .github/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
title: '## Change Log'
# style allow: simple, markdown(mkdown), ghr(gh-release)
style: gh-release
# group names
names: [Refactor, Fixed, Feature, Update, Other]
# if empty will auto fetch by git remote
#repo_url: https://github.com/gookit/goutil

filters:
# message length should >= 12
- name: msg_len
min_len: 12
# message words should >= 3
- name: words_len
min_len: 3
- name: keyword
keyword: format code
exclude: true
- name: keywords
keywords: format code, action test
exclude: true

# group match rules
# not matched will use 'Other' group.
rules:
- name: Refactor
start_withs: [refactor, break]
contains: ['refactor:']
- name: Fixed
start_withs: [fix]
contains: ['fix:']
- name: Feature
start_withs: [feat, new]
contains: [feature, 'feat:']
- name: Update
start_withs: [up]
contains: ['update:', 'up:']
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.0, 8.1] # 7.3, 7.4,
php: [8.1] # 7.3, 7.4,
os: [ubuntu-latest, macOS-latest] # windows-latest,
# include:
# - os: 'ubuntu-latest'
Expand Down
44 changes: 13 additions & 31 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,38 @@ on:

jobs:
release:
name: Test on php ${{ matrix.php}}
name: Release new version
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: [8.0]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set ENV for github-release
- name: Setup ENV
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
tools: pecl, php-cs-fixer, phpunit
extensions: mbstring, dom, fileinfo, mysql, openssl # , swoole-4.4.19 #optional, setup extensions
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
coverage: none #optional, setup coverage driver: xdebug, none

- name: Install dependencies # eg: v1.0.3
run: |
tag1=${GITHUB_REF#refs/*/}
echo "release tag: ${tag1}"
composer install --no-progress
# more see https://github.com/inhere/kite
- name: Generate changelog file
id: changelog
- name: Generate changelog
run: |
wget -c -q https://github.com/inhere/kite/releases/latest/download/kite.phar
php kite.phar git cl prev last --style gh-release --no-merges --fetch-tags --unshallow --file changelog.md
cat changelog.md
curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog
chmod a+x /usr/local/bin/chlog
chlog -c .github/changelog.yml -o changelog.md prev last
# https://github.com/softprops/action-gh-release
- name: Create release and upload assets
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}
body_path: changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GITHUB_REPOSITORY: my_gh_org/my_gh_repo
token: ${{ secrets.GITHUB_TOKEN }}
# files: macos-chlog.exe

0 comments on commit 74a9075

Please sign in to comment.