Skip to content

update: fix ci

update: fix ci #78

Workflow file for this run

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@v4
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: Prepare Swoole-Cli
steps:
# https://www.swoole.com/download
- name: Download
run: |
curl -v -L -O https://github.com/swoole/swoole-cli/releases/download/v5.1.2.0/swoole-cli-v5.1.2-linux-x64.tar.xz
tar -xvf swoole-cli-*.tar.xz
ls -lh .
- name: Test
run: |
./swoole-cli -v
./swoole-cli -r "echo PHP_VERSION, PHP_EOL;"
./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
publish-image:
name: Publish the Image
runs-on: ubuntu-latest
needs:
- build-phar
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: phar-archive
path: .
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository_owner }}/socket-log-server
tags: |
type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
type=ref,enable=true,priority=600,prefix=,suffix=,event=tag
- name: Log in to Github
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}