mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
72 lines
2.2 KiB
YAML
72 lines
2.2 KiB
YAML
name: Increment Build Number
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
types:
|
|
- closed
|
|
paths:
|
|
- 'src/**.php'
|
|
|
|
jobs:
|
|
incremental-build-number:
|
|
if: github.event.pull_request.merged == true
|
|
name: Incremental Build Number
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.base_ref }}
|
|
|
|
- name: Setup PHP
|
|
uses: sunxyw/workflows/setup-environment@main
|
|
with:
|
|
php-version: 8.1
|
|
php-extensions: swoole, posix, json
|
|
operating-system: ubuntu-latest
|
|
use-cache: true
|
|
|
|
- name: Prepare Doxygen
|
|
id: prepare-doxygen
|
|
continue-on-error: true
|
|
run: bin/prepare-doxygen before
|
|
|
|
- name: Generate Doxygen
|
|
if: steps.prepare-doxygen.outcome == 'success'
|
|
uses: mattnotmitt/doxygen-action@v1.9.5
|
|
|
|
- name: Finishing Doxygen
|
|
if: steps.prepare-doxygen.outcome == 'success'
|
|
run: bin/prepare-doxygen after
|
|
|
|
- name: Commit API Docs
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: update api docs
|
|
branch: ${{ github.base_ref }}
|
|
|
|
- name: Update Class Aliases Docs
|
|
run: ./zhamao generate:text class-alias-md
|
|
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.changed_files, 'src/Globals/global_class_alias.php') }}
|
|
|
|
- name: Commit Class Aliases Docs
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: update class aliases docs
|
|
branch: ${{ github.base_ref }}
|
|
|
|
- name: Increment build number
|
|
id: increment-build-number
|
|
run: |
|
|
sed -i -r 's/(.*)(\VERSION_ID\s=\s)([0-9]+)(.*)/echo "\1\2$((\3+1))\4"/ge' src/ZM/Framework.php
|
|
BUILD_ID=$(cat src/ZM/Framework.php | grep "VERSION_ID = " | sed 's/[^0-9]//g')
|
|
echo "::set-output name=build_id::$BUILD_ID"
|
|
|
|
- name: Commit build number
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: increment build number (build ${{ steps.increment-build-number.outputs.build_id }})
|
|
branch: ${{ github.base_ref }}
|