From 91596074666aaccab5f5a0977439fd7015ffbb82 Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Tue, 23 Jun 2026 13:17:50 -0500 Subject: [PATCH 1/2] chore(ci): split release workflow into draft upload and publish steps --- .github/workflows/publish.yml | 63 ++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 93e8251..1ed8dcc 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,15 +1,29 @@ -name: Publish to WordPress and upload zip to the latest release +name: Publish to WordPress and upload zip to the release on: release: - types: [published] + types: [created, edited, published] workflow_dispatch: + inputs: + release_tag: + description: Release tag to upload the zip asset to + required: true + type: string jobs: - build: + upload_release_zip: + if: | + github.event_name == 'workflow_dispatch' || + ( + github.event_name == 'release' && + github.event.release.draft == true && + (github.event.action == 'created' || github.event.action == 'edited') + ) runs-on: ubuntu-latest steps: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + ref: ${{ github.event.release.tag_name || inputs.release_tag }} - name: Install Composer dependencies uses: ramsey/composer-install@26d8a556604053a9612623447203a691f406fbe6 # v4 @@ -27,16 +41,47 @@ jobs: command: 'cd ./openedx-commerce' filename: '../openedx-commerce.zip' - - name: Upload zip to the latest GitHub release - uses: xresloader/upload-to-github-release@7c5757a90c0bcf0c0e1741da8f2abd7b85e675d0 # v1.6.2 + - name: Upload zip to the draft GitHub release + env: + GH_TOKEN: ${{ secrets.WC_PAT }} + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} + run: gh release upload "$RELEASE_TAG" openedx-commerce.zip --clobber + + publish_wordpress: + if: github.event_name == 'release' && github.event.action == 'published' + runs-on: ubuntu-latest + steps: + - name: Check zip asset exists in release + id: check_zip env: - GITHUB_TOKEN: ${{ secrets.WC_PAT }} + GH_TOKEN: ${{ secrets.WC_PAT }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: | + if gh release view "$RELEASE_TAG" --json assets --jq '.assets[].name' | grep -q '^openedx-commerce\.zip$'; then + echo "zip_found=true" >> "$GITHUB_OUTPUT" + else + echo "::warning::openedx-commerce.zip not found in release assets for $RELEASE_TAG. Skipping WordPress publish." + echo "zip_found=false" >> "$GITHUB_OUTPUT" + fi + + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + if: steps.check_zip.outputs.zip_found == 'true' with: - file: "openedx-commerce.zip" - update_latest_release: true - draft: false + ref: ${{ github.event.release.tag_name }} + + - name: Download zip from release + if: steps.check_zip.outputs.zip_found == 'true' + env: + GH_TOKEN: ${{ secrets.WC_PAT }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: gh release download "$RELEASE_TAG" --pattern "openedx-commerce.zip" + + - name: Extract zip + if: steps.check_zip.outputs.zip_found == 'true' + run: unzip -o openedx-commerce.zip -d openedx-commerce - name: Publish to WordPress SVN + if: steps.check_zip.outputs.zip_found == 'true' uses: ./.github/actions/svn-publish with: svn-repository: https://plugins.svn.wordpress.org/openedx-commerce/ From 8445579df16307506a166aab601d0fa1c8d06ccf Mon Sep 17 00:00:00 2001 From: Maria Fernanda Magallanes Zubillaga Date: Tue, 23 Jun 2026 13:21:35 -0500 Subject: [PATCH 2/2] chore: avoid publish to wp but verify access --- .github/workflows/publish.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1ed8dcc..4eb6360 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -80,12 +80,6 @@ jobs: if: steps.check_zip.outputs.zip_found == 'true' run: unzip -o openedx-commerce.zip -d openedx-commerce - - name: Publish to WordPress SVN + - name: Check openedx-commerce directory access if: steps.check_zip.outputs.zip_found == 'true' - uses: ./.github/actions/svn-publish - with: - svn-repository: https://plugins.svn.wordpress.org/openedx-commerce/ - svn-username: ${{ secrets.WORDPRESS_SVN_USERNAME }} - svn-password: ${{ secrets.WORDPRESS_SVN_PASSWORD }} - assets-directory: ../docs/source/_images/plugin-page - working-directory: openedx-commerce + run: cd openedx-commerce && pwd