diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index f69e3a2b3..e164c8328 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -9,7 +9,7 @@ on: jobs: - build: #--------------------------------------------------------------------- + build: #---------------------------------------------------------------------- name: Build Phar runs-on: ubuntu-latest @@ -184,7 +184,7 @@ jobs: WP_VERSION: '${{ matrix.wp }}' run: composer behat || composer behat-rerun - deploy: #----------------------------------------------------------------------- + deploy: #--------------------------------------------------------------------- name: Deployment runs-on: ubuntu-latest needs: [build, test] @@ -259,7 +259,57 @@ jobs: branch: gh-pages repository: wp-cli/builds - build-rpm: #----------------------------------------------------------------------- + deploy-shim: #---------------------------------------------------------------- + name: Deployment (Composer shim) + runs-on: ubuntu-latest + needs: [build, test] + + if: ${{ github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }} + steps: + - name: Check out shim repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: wp-cli/wp-cli-shim + token: ${{ secrets.ACTIONS_BOT }} + + - name: Download WP-CLI version + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: cli_version + + - name: Download built Phar file + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + with: + name: wp-cli-phar + + - name: Move built Phar file into correct location + run: | + mv wp-cli.phar 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@881a6320fdb16eb5318c5054f31c218aec2b324c # v1 + with: + github_token: ${{ secrets.ACTIONS_BOT }} + branch: main + tags: true + 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' }} @@ -348,7 +398,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' }}