From c283a842637e18f01b72db4c2dbb047f23afafe7 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Fri, 17 Feb 2023 16:32:10 +0800 Subject: [PATCH] update workflows --- .github/workflows/build-release-artifacts.yml | 68 +++++++++++++++++++ .github/workflows/increment-build-number.yml | 10 +++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/build-release-artifacts.yml diff --git a/.github/workflows/build-release-artifacts.yml b/.github/workflows/build-release-artifacts.yml new file mode 100644 index 00000000..54394115 --- /dev/null +++ b/.github/workflows/build-release-artifacts.yml @@ -0,0 +1,68 @@ +name: Build Release Artifacts + +on: + release: + types: + - published + workflow_dispatch: + +jobs: + build-release-artifacts: + name: Build Release Artifacts + 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: Build Phar + run: ./zhamao build + + - name: Get Latest Release Upload URL + id: get-latest-release + run: curl https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.upload_url' | sed 's/{?name,label}//g' > upload_url.txt + + - name: Upload Phar + run: | + curl -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"\ + -H "X-GitHub-Api-Version: 2022-11-28" \ + -H "Content-Type: application/octet-stream" \ + $(cat upload_url.txt)/zm.phar \ + --data-binary "@build/zm.phar" + + update-changelog: + name: Update Changelog + 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: Update Changelog + run: ./zhamao generate:text update-log-md + + - name: Commit Changelog + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: update changelog + branch: ${{ github.base_ref }} diff --git a/.github/workflows/increment-build-number.yml b/.github/workflows/increment-build-number.yml index ca096f11..bbb4bb8b 100644 --- a/.github/workflows/increment-build-number.yml +++ b/.github/workflows/increment-build-number.yml @@ -47,6 +47,16 @@ jobs: 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: |