Skip to content
52 changes: 48 additions & 4 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:

build: #---------------------------------------------------------------------
build: #----------------------------------------------------------------------
name: Build Phar
runs-on: ubuntu-latest

Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
WP_VERSION: '${{ matrix.wp }}'
run: composer behat || composer behat-rerun

deploy: #-----------------------------------------------------------------------
deploy: #---------------------------------------------------------------------
name: Deployment
runs-on: ubuntu-latest
needs: [build, test]
Expand Down Expand Up @@ -256,7 +256,51 @@ jobs:
branch: gh-pages
repository: wp-cli/builds

build-rpm: #-----------------------------------------------------------------------
deploy-shim: #----------------------------------------------------------------
name: Deployment
runs-on: ubuntu-latest
needs: [build, test]

if: ${{ github.repository_owner == 'wp-cli' }}
steps:
- name: Check out phar repository
uses: actions/checkout@v4
with:
repository: wp-cli/wp-cli-shim
token: ${{ secrets.ACTIONS_BOT }}

- name: Download WP-CLI version
uses: actions/download-artifact@v7
with:
name: cli_version

- name: Download built Phar file
uses: actions/download-artifact@v7
with:
name: wp

- name: Make built Phar executable
run: |
chmod +x wp

- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add wp
git commit -m "phar build: $GITHUB_REPOSITORY@$GITHUB_SHA"

- name: Tag stable release
if: ${{ contains(github.ref, 'release') }}
run: git tag "v$(head -n 1 cli_version.txt)"

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.ACTIONS_BOT }}
repository: wp-cli/wp-cli-shim

build-rpm: #------------------------------------------------------------------
name: Build RPM package
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
Expand Down Expand Up @@ -310,7 +354,7 @@ jobs:
branch: gh-pages
repository: wp-cli/builds

build-deb: #-----------------------------------------------------------------------
build-deb: #------------------------------------------------------------------
name: Build DEB package
runs-on: ubuntu-latest
if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }}
Expand Down