update: 更新构建工具 #71
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
on: | |
push: | |
branches: | |
- 'master' | |
- 'dev-**' | |
- 'dev/**' | |
tags: | |
- 'v*.**' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
# release: | |
# types: | |
# - created | |
# - prerelease | |
name: Upload Release Asset | |
jobs: | |
build-phar: | |
name: Build PHAR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup PHP with PECL extension | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
ini-values: phar.readonly=0 | |
tools: composer:v2 | |
coverage: none | |
extensions: zip | |
- uses: ramsey/composer-install@v2 | |
with: | |
dependency-versions: "locked" | |
composer-options: "--optimize-autoloader --no-dev" | |
- name: Download box | |
run: | | |
wget https://github.com/box-project/box/releases/download/4.5.1/box.phar | |
- name: Build project # This would actually build your project, using zip for an example artifact | |
run: | | |
composer install --prefer-dist --no-dev --no-progress | |
php box.phar compile | |
./bin/socket-log-server.phar --version | |
- uses: actions/upload-artifact@v3 | |
name: Upload the PHAR artifact | |
with: | |
name: phar-archive | |
path: ./bin/socket-log-server.phar | |
build-swoole-linux: | |
runs-on: ubuntu-latest | |
name: Down Swoole-Cli SFX | |
steps: | |
# https://www.swoole.com/download | |
- name: Prepare | |
run: | | |
curl -O https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v5.1.0-linux-x64.tar.xz | |
tar -xvf swoole-cli-*.tar.xz | |
ls -lh . | |
- name: Test | |
run: | | |
./swoole-cli -v | |
./swoole-cli -m | |
./swoole-cli --ri swoole | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist-swoole-cli | |
path: | | |
swoole-cli | |
pack-sfx.php | |
pack-sfx: | |
runs-on: ubuntu-latest | |
name: Pack SFX | |
needs: | |
- build-phar | |
- build-swoole-linux | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: phar-archive | |
path: . | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist-swoole-cli | |
path: . | |
- name: Pack SFX | |
run: | | |
chmod +x ./swoole-cli | |
./swoole-cli ./pack-sfx.php ./socket-log-server.phar ./socket-log-linux-sfx | |
./socket-log-linux-sfx --self -- --version | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: socket-log-binary | |
path: | | |
socket-log-linux-sfx | |
publish-phar: | |
runs-on: ubuntu-latest | |
name: Publish the PHAR | |
needs: | |
- build-phar | |
- pack-sfx | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: phar-archive | |
path: . | |
- uses: actions/download-artifact@v3 | |
with: | |
name: socket-log-binary | |
path: . | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
files: | | |
socket-log-server.phar | |
socket-log-linux-sfx |