Skip to content

Commit 3a63ded

Browse files
committed
Add build step for wp-cli/phar
1 parent 4142af1 commit 3a63ded

1 file changed

Lines changed: 51 additions & 4 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
jobs:
1010

11-
build: #---------------------------------------------------------------------
11+
build: #----------------------------------------------------------------------
1212
name: Build Phar
1313
runs-on: ubuntu-latest
1414

@@ -187,7 +187,7 @@ jobs:
187187
WP_VERSION: '${{ matrix.wp }}'
188188
run: composer behat || composer behat-rerun
189189

190-
deploy: #-----------------------------------------------------------------------
190+
deploy: #---------------------------------------------------------------------
191191
name: Deployment
192192
runs-on: ubuntu-latest
193193
needs: [build, test]
@@ -251,7 +251,54 @@ jobs:
251251
branch: gh-pages
252252
repository: wp-cli/builds
253253

254-
build-rpm: #-----------------------------------------------------------------------
254+
deploy-shim: #----------------------------------------------------------------
255+
name: Deployment
256+
runs-on: ubuntu-latest
257+
needs: [build, test]
258+
259+
if: ${{ github.repository_owner == 'wp-cli' }}
260+
steps:
261+
- name: Check out phar repository
262+
uses: actions/checkout@v4
263+
with:
264+
repository: wp-cli/phar
265+
token: ${{ secrets.ACTIONS_BOT }}
266+
267+
- name: Download WP-CLI version
268+
uses: actions/download-artifact@v3
269+
with:
270+
name: cli_version
271+
272+
- name: Download built Phar file
273+
uses: actions/download-artifact@v3
274+
with:
275+
name: wp-cli-phar
276+
277+
- name: Make built Phar executable
278+
run: |
279+
chmod +x wp-cli.phar
280+
281+
- name: Commit files
282+
run: |
283+
git config --local user.email "action@github.com"
284+
git config --local user.name "GitHub Action"
285+
git add wp-cli.phar
286+
git commit -m "phar build: $GITHUB_REPOSITORY@$GITHUB_SHA"
287+
288+
- name: Tag stable release
289+
if: ${{ contains(github.ref, 'release') }}
290+
run: |
291+
VERSION=$(cat cli_version.txt)
292+
git tag "v$VERSION"
293+
294+
- name: Push changes
295+
uses: ad-m/github-push-action@master
296+
with:
297+
github_token: ${{ secrets.ACTIONS_BOT }}
298+
branch: gh-pages
299+
repository: wp-cli/phar
300+
301+
build-rpm: #------------------------------------------------------------------
255302
name: Build RPM package
256303
runs-on: ubuntu-latest
257304
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}
@@ -305,7 +352,7 @@ jobs:
305352
branch: gh-pages
306353
repository: wp-cli/builds
307354

308-
build-deb: #-----------------------------------------------------------------------
355+
build-deb: #------------------------------------------------------------------
309356
name: Build DEB package
310357
runs-on: ubuntu-latest
311358
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }}

0 commit comments

Comments
 (0)