-
Notifications
You must be signed in to change notification settings - Fork 2
162 lines (156 loc) · 4.49 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
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 -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 }}