From 3a63dedc4e99cc2b1e3c9b0848ecd6300a2c7187 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 27 Oct 2023 13:55:20 +0200 Subject: [PATCH 1/7] Add build step for `wp-cli/phar` --- .github/workflows/deployment.yml | 55 +++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 48420a891..2f747f076 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -8,7 +8,7 @@ on: jobs: - build: #--------------------------------------------------------------------- + build: #---------------------------------------------------------------------- name: Build Phar runs-on: ubuntu-latest @@ -187,7 +187,7 @@ jobs: WP_VERSION: '${{ matrix.wp }}' run: composer behat || composer behat-rerun - deploy: #----------------------------------------------------------------------- + deploy: #--------------------------------------------------------------------- name: Deployment runs-on: ubuntu-latest needs: [build, test] @@ -251,7 +251,54 @@ 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/phar + token: ${{ secrets.ACTIONS_BOT }} + + - name: Download WP-CLI version + uses: actions/download-artifact@v3 + with: + name: cli_version + + - name: Download built Phar file + uses: actions/download-artifact@v3 + with: + name: wp-cli-phar + + - name: Make built Phar executable + run: | + chmod +x wp-cli.phar + + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add wp-cli.phar + git commit -m "phar build: $GITHUB_REPOSITORY@$GITHUB_SHA" + + - name: Tag stable release + if: ${{ contains(github.ref, 'release') }} + run: | + VERSION=$(cat cli_version.txt) + git tag "v$VERSION" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.ACTIONS_BOT }} + branch: gh-pages + repository: wp-cli/phar + + build-rpm: #------------------------------------------------------------------ name: Build RPM package runs-on: ubuntu-latest if: ${{ contains(github.ref, 'release') && github.repository_owner == 'wp-cli' }} @@ -305,7 +352,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' }} From 076ff21dfdbdb329b0ec08580f54559ab409b0a6 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 9 Nov 2023 13:47:46 +0100 Subject: [PATCH 2/7] Update `git tag` command --- .github/workflows/deployment.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 2f747f076..bc2a8dc09 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -287,9 +287,7 @@ jobs: - name: Tag stable release if: ${{ contains(github.ref, 'release') }} - run: | - VERSION=$(cat cli_version.txt) - git tag "v$VERSION" + run: git tag "v$(head -n 1 cli_version.txt)" - name: Push changes uses: ad-m/github-push-action@master From 81575ffe8a5862cb5c8d2508e46105e023161788 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 10 Nov 2023 15:58:02 +0100 Subject: [PATCH 3/7] Rename repo and phar --- .github/workflows/deployment.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index bc2a8dc09..feab07172 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -261,7 +261,7 @@ jobs: - name: Check out phar repository uses: actions/checkout@v4 with: - repository: wp-cli/phar + repository: wp-cli/wp-cli-shim token: ${{ secrets.ACTIONS_BOT }} - name: Download WP-CLI version @@ -272,17 +272,17 @@ jobs: - name: Download built Phar file uses: actions/download-artifact@v3 with: - name: wp-cli-phar + name: wp - name: Make built Phar executable run: | - chmod +x wp-cli.phar + 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-cli.phar + git add wp git commit -m "phar build: $GITHUB_REPOSITORY@$GITHUB_SHA" - name: Tag stable release @@ -294,7 +294,7 @@ jobs: with: github_token: ${{ secrets.ACTIONS_BOT }} branch: gh-pages - repository: wp-cli/phar + repository: wp-cli/wp-cli-shim build-rpm: #------------------------------------------------------------------ name: Build RPM package From 9b58d48ec05c001fe10b4708c85dcec1762f4cf8 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 12 Jan 2026 13:52:57 +0100 Subject: [PATCH 4/7] Update .github/workflows/deployment.yml --- .github/workflows/deployment.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ec183edbf..621ad379e 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -293,7 +293,6 @@ jobs: uses: ad-m/github-push-action@master with: github_token: ${{ secrets.ACTIONS_BOT }} - branch: gh-pages repository: wp-cli/wp-cli-shim build-rpm: #------------------------------------------------------------------ From 7d9499e5d6049775afe404d5e1e46cedfff87192 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 12 Jan 2026 14:21:12 +0100 Subject: [PATCH 5/7] Apply suggestions from code review --- .github/workflows/deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index b82d077dc..32ea5e4a4 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -270,12 +270,12 @@ jobs: token: ${{ secrets.ACTIONS_BOT }} - name: Download WP-CLI version - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v7 with: name: cli_version - name: Download built Phar file - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v7 with: name: wp From a2dcb34852bd7ecf1edbcf4c9220cf550770656e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 10 Aug 2026 13:32:04 +0000 Subject: [PATCH 6/7] Fix artifact handling in shim deployment job The `deploy-shim` job downloaded an artifact named `wp`, but the build job uploads it as `wp-cli-phar` containing `wp-cli.phar`, so the download failed and the subsequent `chmod`/`git add` had no file to operate on. Download the correct artifact and rename the Phar to `wp`, which is what `wp-cli/wp-cli-shim` declares as its `bin`. Also align the job with the existing `deploy` job: * Give it a distinct display name, as both were labelled "Deployment". * Pin `actions/checkout`, `actions/download-artifact` and `ad-m/github-push-action` to the same SHAs used elsewhere in this workflow, instead of floating tags and `@master`. * Push to `main` explicitly. Without it the action defaults to the current ref, which would push to a branch named after the bundle's ref rather than the shim's default branch. * Push tags, so the "Tag stable release" step is no longer a no-op. * Skip on `workflow_dispatch`, matching `deploy`. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01RHtjyXkZh8X16sBgmidSQi --- .github/workflows/deployment.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index ef08b30ae..e164c8328 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -260,27 +260,31 @@ jobs: repository: wp-cli/builds deploy-shim: #---------------------------------------------------------------- - name: Deployment + name: Deployment (Composer shim) runs-on: ubuntu-latest needs: [build, test] - if: ${{ github.repository_owner == 'wp-cli' }} + if: ${{ github.repository_owner == 'wp-cli' && github.event_name != 'workflow_dispatch' }} steps: - - name: Check out phar repository - uses: actions/checkout@v4 + - 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@v7 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: name: cli_version - name: Download built Phar file - uses: actions/download-artifact@v7 + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 with: - name: wp + name: wp-cli-phar + + - name: Move built Phar file into correct location + run: | + mv wp-cli.phar wp - name: Make built Phar executable run: | @@ -298,9 +302,11 @@ jobs: run: git tag "v$(head -n 1 cli_version.txt)" - name: Push changes - uses: ad-m/github-push-action@master + 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: #------------------------------------------------------------------ From c5184dc1b8f4b9ca81356687c05c1930e22488d6 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 24 Nov 2026 10:24:51 +0000 Subject: [PATCH 7/7] Align shim deployment job with the deploy job Download the artifacts in parallel with the same pinned action as the deploy job, and leave the separator comments of the other jobs as they are on main. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01UWTd5pwpi2xQfDA6mUYkkx --- .github/workflows/deployment.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index e7d38c209..414e0caa4 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 @@ -197,7 +197,7 @@ jobs: WP_VERSION: '${{ matrix.wp }}' run: composer behat || composer behat-rerun - deploy: #--------------------------------------------------------------------- + deploy: #----------------------------------------------------------------------- name: Deployment runs-on: ubuntu-latest needs: [build, test] @@ -273,7 +273,7 @@ jobs: branch: gh-pages repository: wp-cli/builds - deploy-shim: #---------------------------------------------------------------- + deploy-shim: #----------------------------------------------------------------------- name: Deployment (Composer shim) runs-on: ubuntu-latest needs: [build, test] @@ -286,15 +286,16 @@ jobs: 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 + - parallel: + - name: Download WP-CLI version + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 + with: + name: cli_version - - name: Download built Phar file - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 - with: - name: wp-cli-phar + - name: Download built Phar file + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8 + with: + name: wp-cli-phar - name: Move built Phar file into correct location run: | @@ -323,7 +324,7 @@ jobs: tags: true repository: wp-cli/wp-cli-shim - build-rpm: #------------------------------------------------------------------ + 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' }} @@ -418,7 +419,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' }}