fix: default file_types/file_size for file & cropper fields (#658) #1339
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and publish the ZIP build file | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, ready_for_review] | |
| branches-ignore: | |
| - "update_dependencies" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| dev-zip: | |
| name: Build ZIP and upload to s3 | |
| if: github.event.pull_request.draft == false && github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name | |
| runs-on: ubuntu-latest | |
| outputs: | |
| branch-name: ${{ steps.retrieve-branch-name.outputs.branch_name }} | |
| git-sha-8: ${{ steps.retrieve-git-sha-8.outputs.sha8 }} | |
| steps: | |
| - name: Check out source files | |
| uses: actions/checkout@master | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| - name: Install composer deps | |
| run: composer install --no-dev --prefer-dist --no-progress --no-suggest | |
| - name: Install npm deps | |
| run: npm ci | |
| - name: Build files | |
| run: npm run build | |
| - name: Bump the plugin version | |
| run: | | |
| CURRENT_VERSION=$(node -p -e "require('./package.json').version") | |
| COMMIT_HASH=$(git rev-parse --short HEAD) | |
| DEV_VERSION="${CURRENT_VERSION}-dev.${COMMIT_HASH}" | |
| npm run grunt version::${DEV_VERSION} | |
| - name: Create zip | |
| run: npm run dist | |
| - name: Retrieve branch name | |
| id: retrieve-branch-name | |
| run: echo "::set-output name=branch_name::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" | |
| - name: Retrieve git SHA-8 string | |
| id: retrieve-git-sha-8 | |
| run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | |
| - name: Upload Latest Version to S3 | |
| uses: jakejarvis/s3-sync-action@master | |
| with: | |
| args: --acl public-read --follow-symlinks --delete | |
| env: | |
| AWS_S3_BUCKET: ${{ secrets.AWS_DEV_BUCKET }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.S3_AWS_KEY_ARTIFACTS }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_AWS_SECRET_ARTIFACTS }} | |
| SOURCE_DIR: artifact/ | |
| DEST_DIR: ${{ github.event.pull_request.base.repo.name }}-${{ steps.retrieve-branch-name.outputs.branch_name }}-${{ steps.retrieve-git-sha-8.outputs.sha8 }}/ | |
| comment-on-pr: | |
| name: Comment on PR with links to plugin ZIPs | |
| if: ${{ github.head_ref && github.head_ref != null }} | |
| runs-on: ubuntu-latest | |
| needs: dev-zip | |
| env: | |
| CI: true | |
| GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
| outputs: | |
| pr_number: ${{ steps.get-pr-number.outputs.num }} | |
| comment_body: ${{ steps.get-comment-body.outputs.body }} | |
| steps: | |
| - name: Check out source files | |
| uses: actions/checkout@v6 | |
| - name: Get PR number | |
| id: get-pr-number | |
| run: echo "::set-output name=num::$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')" | |
| - name: Check if a comment was already made | |
| id: find-comment | |
| uses: peter-evans/find-comment@v2 | |
| with: | |
| issue-number: ${{ steps.get-pr-number.outputs.num }} | |
| comment-author: pirate-bot | |
| body-includes: Download PPOM | |
| - name: Get comment body | |
| id: get-comment-body | |
| env: | |
| GITHUB_REPO_NAME: ${{ github.event.pull_request.base.repo.name }} | |
| DEV_ZIP_BRANCH_NAME: ${{ needs.dev-zip.outputs.branch-name }} | |
| DEV_ZIP_GIT_SHA_8: ${{ needs.dev-zip.outputs.git-sha-8 }} | |
| GITHUB_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| previewLink=$(node ./bin/generatePlaygroundPreviewLink.js) | |
| body=" | |
| > [!TIP] | |
| > You can preview the changes in the <a href=\"$previewLink\" target=\"_blank\">Playground</a> | |
| Plugin build for ${{ github.event.pull_request.head.sha }} is ready :bellhop_bell:! | |
| - Download PPOM - [build 🔗](https://verti-artifacts.s3.amazonaws.com/${{ github.event.pull_request.base.repo.name }}-${{ needs.dev-zip.outputs.branch-name }}-${{ needs.dev-zip.outputs.git-sha-8 }}/woocommerce-product-addon.zip)" | |
| body="${body//$'\n'/'%0A'}" | |
| echo "::set-output name=body::$body" | |
| - name: Create comment on PR with links to plugin builds | |
| if: ${{ steps.find-comment.outputs.comment-id == '' }} | |
| uses: peter-evans/create-or-update-comment@v2 | |
| with: | |
| issue-number: ${{ steps.get-pr-number.outputs.num }} | |
| token: ${{ secrets.BOT_TOKEN }} | |
| body: ${{ steps.get-comment-body.outputs.body }} | |
| - name: Update comment on PR with links to plugin builds | |
| if: ${{ steps.find-comment.outputs.comment-id != '' }} | |
| uses: peter-evans/create-or-update-comment@v2 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| edit-mode: replace | |
| token: ${{ secrets.BOT_TOKEN }} | |
| body: ${{ steps.get-comment-body.outputs.body }} |