diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index e214a1171..000000000 --- a/.eslintignore +++ /dev/null @@ -1,6 +0,0 @@ -**/*.min.js -**/node_modules/** -**/vendor/** -**/js/*.js -build/* -built/* \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index a8e71723b..000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "env": { - "browser": true - }, - "globals": { - "cloudinary": "readonly", - "jQuery": "readonly", - "$": "readonly", - "CLDN": "readonly", - "CLDLB": "readonly", - "CLD_GLOBAL_TRANSFORMATIONS": "readonly", - "samplePlayer": "readonly", - "CLDCACHE": "readonly", - "cldData": "readonly", - "CLD_METADATA": "readonly" - }, - "extends": [ - "plugin:@wordpress/eslint-plugin/recommended" - ], - "rules": { - "no-alert": "off", - "no-console": "off", - "no-unused-vars": "off", - "no-nested-ternary": "off", - "jsx-a11y/click-events-have-key-events": "off", - "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "warn", - "@wordpress/no-global-event-listener": "off" - } -} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..378741ac9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: composer + directory: / + schedule: + interval: weekly + target-branch: develop + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + target-branch: develop + groups: + wordpress: + patterns: + - "@wordpress/*" diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml new file mode 100644 index 000000000..30e8ae788 --- /dev/null +++ b/.github/workflows/build-docs.yml @@ -0,0 +1,37 @@ +name: Build Docs + +on: + push: + branches: + - master + release: + types: [published] + workflow_dispatch: + +permissions: + contents: write + +jobs: + hookdocs: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build docs + run: npm run build:docs + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs diff --git a/.github/workflows/deploy-to-wp-org.yml b/.github/workflows/deploy-to-wp-org.yml index 94c4bc7e8..805d5e766 100644 --- a/.github/workflows/deploy-to-wp-org.yml +++ b/.github/workflows/deploy-to-wp-org.yml @@ -78,15 +78,21 @@ jobs: - name: Prepare build directory run: npx grunt prepare + # Read once so both the tag check and the deploy step use the exact same value, rather + # than letting the deploy action derive its own version from GITHUB_REF - that only works + # when triggered from a tag push, and yields a bogus value like "refs/heads/master" (which + # SVN then can't use as a tag path) on a workflow_dispatch run against a branch. + - name: Read plugin version + run: echo "PLUGIN_VERSION=$(cat .version | tr -d '[:space:]')" >> "$GITHUB_ENV" + # Ensure the version in the .version file matches the tag of the release. # Skipped for manual runs, which may not be run against a release tag. - name: Verify version matches tag if: github.event_name == 'release' run: | TAG="${GITHUB_REF_NAME#v}" - FILE_VERSION=$(cat .version | tr -d '[:space:]') - if [ "$TAG" != "$FILE_VERSION" ]; then - echo "::error::Tag $TAG does not match .version $FILE_VERSION" + if [ "$TAG" != "$PLUGIN_VERSION" ]; then + echo "::error::Tag $TAG does not match .version $PLUGIN_VERSION" exit 1 fi @@ -102,10 +108,20 @@ jobs: env: BUILD_DIR: 'build' SLUG: 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn' + VERSION: ${{ env.PLUGIN_VERSION }} # Use secrets to authenticate with WP.org. SVN_USERNAME: ${{ secrets.SVN_USERNAME }} SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + # Makes the zip downloadable from the run's Artifacts panel regardless of trigger, so + # manual/dry-run dispatches can be inspected without publishing a release. + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PLUGIN_VERSION }}.zip + path: ${{ steps.deploy.outputs.zip-path }} + retention-days: 7 + - name: Upload release asset if: github.event_name == 'release' uses: softprops/action-gh-release@v2 diff --git a/.gitignore b/.gitignore index 219524cb7..e13e87800 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,6 @@ package/dist # PHPStan result cache /.phpstan-cache/ + +# Generated docs (published to gh-pages by workflow) +/docs/ diff --git a/.hookdoc/layout.tmpl b/.hookdoc/layout.tmpl new file mode 100644 index 000000000..46f764c5a --- /dev/null +++ b/.hookdoc/layout.tmpl @@ -0,0 +1,46 @@ + + +
+ +