@@ -188,52 +188,53 @@ jobs:
188
188
path : /var/crash
189
189
190
190
publish :
191
- needs : [build]
192
- runs-on : ${{ matrix.operating-system }}
191
+ if : github.repository == 'SkyAPM/SkyAPM-php-sdk'
192
+ runs-on : ubuntu-latest
193
+ permissions :
194
+ contents : read
195
+ packages : write
193
196
strategy :
194
197
matrix :
195
- operating-system : [ubuntu-latest]
196
198
php-version : ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
197
199
name : Publish PHP ${{ matrix.php-version }}
198
200
steps :
199
201
- name : Checkout
200
202
uses : actions/checkout@v2
201
203
204
+ - name : Log in to Docker Hub
205
+ uses : docker/login-action@v1
206
+ with :
207
+ username : ${{ secrets.DOCKER_USERNAME }}
208
+ password : ${{ secrets.DOCKER_PASSWORD }}
209
+
210
+ - name : Log in to the Container registry
211
+ uses : docker/login-action@v1
212
+ with :
213
+ registry : ghcr.io
214
+ username : ${{ github.actor }}
215
+ password : ${{ secrets.GITHUB_TOKEN }}
216
+
217
+ - name : Extract metadata for Docker
218
+ id : meta
219
+ uses : docker/metadata-action@v3
220
+ with :
221
+ images : |
222
+ skyapm/skywalking-php
223
+ ghcr.io/skyapm/skywalking-php
224
+
202
225
- name : Set output
203
226
id : vars
204
227
run : echo ::set-output name=tag::${GITHUB_REF#refs/*/}
205
228
206
229
- name : Check output
207
230
run : echo ${{ steps.vars.outputs.tag }}
208
231
209
- - name : Publish Dokcer image
210
- if : github.repository == 'SkyAPM/SkyAPM-php-sdk' && github.event_name == 'push' && steps.vars.outputs.tag == 'master' && matrix.php-version == '8.0'
211
- uses : elgohr/Publish-Docker-Github-Action@3.04
232
+ - name : Build and push
233
+ uses : docker/build-push-action@v2
212
234
with :
213
- name : skyapm/skywalking-php
214
- username : ${{ secrets.DOCKER_USERNAME }}
215
- password : ${{ secrets.DOCKER_PASSWORD }}
216
- dockerfile : docker/Dockerfile
217
- buildargs : PHP_VERSION=${{ matrix.php-version }}
218
- tags : " latest,master-${{ matrix.php-version }}-fpm-alpine"
219
-
220
- - name : Publish Dokcer image
221
- if : github.repository == 'SkyAPM/SkyAPM-php-sdk' && github.event_name == 'push' && steps.vars.outputs.tag == 'master' && matrix.php-version != '8.0'
222
- uses : elgohr/Publish-Docker-Github-Action@3.04
223
- with :
224
- name : skyapm/skywalking-php
225
- username : ${{ secrets.DOCKER_USERNAME }}
226
- password : ${{ secrets.DOCKER_PASSWORD }}
227
- dockerfile : docker/Dockerfile
228
- buildargs : PHP_VERSION=${{ matrix.php-version }}
229
- tags : " master-${{ matrix.php-version }}-fpm-alpine"
230
- - name : Publish Dokcer image
231
- if : github.repository == 'SkyAPM/SkyAPM-php-sdk' && github.event_name == 'push' && steps.vars.outputs.tag != 'master' && startsWith(steps.vars.outputs.tag, 'v')
232
- uses : elgohr/Publish-Docker-Github-Action@3.04
233
- with :
234
- name : skyapm/skywalking-php
235
- username : ${{ secrets.DOCKER_USERNAME }}
236
- password : ${{ secrets.DOCKER_PASSWORD }}
237
- dockerfile : docker/Dockerfile
238
- buildargs : PHP_VERSION=${{ matrix.php-version }}
239
- tags : " ${{steps.vars.outputs.tag}}-${{ matrix.php-version }}-fpm-alpine"
235
+ context : .
236
+ file : docker/Dockerfile
237
+ build-args : PHP_VERSION=${{ matrix.php-version }}
238
+ push : ${{ github.event_name != 'pull_request' }}
239
+ tags : ${{ steps.vars.outputs.tag }}-${{ matrix.php-version }}-fpm-alpine
240
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments