From 3a63dedc4e99cc2b1e3c9b0848ecd6300a2c7187 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Fri, 27 Oct 2023 13:55:20 +0200 Subject: [PATCH 1/3] 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 48420a89..2f747f07 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/3] 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 2f747f07..bc2a8dc0 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/3] 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 bc2a8dc0..feab0717 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