diff --git a/.distignore b/.distignore index 3b1706d..a497989 100644 --- a/.distignore +++ b/.distignore @@ -13,6 +13,8 @@ .npmrc .nvmrc .stylelintignore +.wp-env.json +.wp-env.override.json babel.config.js commitlint.config.js jest.config.js @@ -31,6 +33,7 @@ tests/ # Documentation docs/ DEVELOPMENT.md +README.md # WordPress.org assets (separate from plugin) wp-assets/ @@ -70,6 +73,7 @@ blueprint.json *.log *.map *.zip +coverage/ .distignore .DS_Store Thumbs.db diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36a5b17..649423a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,47 +1,114 @@ -name: Release Plugin +name: Deploy to WordPress.org on: push: branches: - main + tags: + - '*' + +permissions: + contents: read jobs: - build-and-release: - name: Build and Release + deploy: + name: Build and Deploy Plugin runs-on: ubuntu-latest permissions: - contents: write # Required to create releases and tags + contents: read steps: + # actions/checkout v4 is intentionally used here instead of a newer major version. + # 10up/action-wordpress-plugin-deploy requires v4 for compatibility. + # See: https://github.com/marketplace/actions/wordpress-plugin-deploy#example-workflow-files - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + with: + fetch-depth: 0 + + - name: Ensure tag is on main + if: startsWith(github.ref, 'refs/tags/') + shell: bash + run: | + git fetch origin main:refs/remotes/origin/main + TAG_COMMIT="$(git rev-list -n 1 "${GITHUB_REF_NAME}")" + + if ! git merge-base --is-ancestor "${TAG_COMMIT}" origin/main; then + echo "::error::Release tags must point to commits that exist on main." + exit 1 + fi + + - name: Validate release tag format + if: startsWith(github.ref, 'refs/tags/') + shell: bash + run: | + if [[ ! "${GITHUB_REF_NAME}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Release tags must use numeric format like 1.0.0, not v1.0.0." + exit 1 + fi - name: Setup PHP - uses: shivammathur/setup-php@v2 + uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # 2.37.1 with: php-version: '8.2' - tools: composer + tools: composer:v2 + coverage: none - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Install PHP dependencies + uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0 with: - node-version: '20' + composer-options: '--no-dev --optimize-autoloader' - - name: Get Version - id: get_version - run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_OUTPUT + - name: Setup Node.js + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # 6.4.0 + with: + node-version-file: '.nvmrc' + cache: 'npm' - - name: Build Plugin ZIP - run: make zip + - name: Install npm dependencies & build assets + shell: bash + run: | + npm ci + npm run build - - name: Create Release and Upload Asset - uses: softprops/action-gh-release@v1 + - name: WordPress Plugin Deploy + id: deploy + uses: 10up/action-wordpress-plugin-deploy@54bd289b8525fd23a5c365ec369185f2966529c2 # 2.3.0 with: - tag_name: v${{ steps.get_version.outputs.VERSION }} - name: v${{ steps.get_version.outputs.VERSION }} - generate_release_notes: true - files: rt-carousel.zip + generate-zip: 'true' + dry-run: ${{ github.ref == 'refs/heads/main' }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SLUG: 'rt-carousel' + ASSETS_DIR: 'wp-assets' + SVN_USERNAME: ${{ secrets.SVN_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} + VERSION: '${{ github.ref_name }}' - \ No newline at end of file + - name: Upload Package Artifact + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: rt-carousel-${{ github.ref_name }} + path: ${{ steps.deploy.outputs.zip-path }} + + github-release: + name: Upload GitHub Release Artifact + needs: deploy + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download Package Artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: rt-carousel-${{ github.ref_name }} + path: release-artifact + + - name: Upload Release Artifact + uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda # v3.0.0 + with: + tag_name: ${{ github.ref_name }} + name: ${{ github.ref_name }} + generate_release_notes: true + files: release-artifact/rt-carousel.zip diff --git a/wp-assets/banner-1544x500.png b/wp-assets/banner-1544x500.png index d0adc4f..a953c61 100644 Binary files a/wp-assets/banner-1544x500.png and b/wp-assets/banner-1544x500.png differ diff --git a/wp-assets/banner-772x250.png b/wp-assets/banner-772x250.png index 9ada422..c21b03b 100644 Binary files a/wp-assets/banner-772x250.png and b/wp-assets/banner-772x250.png differ diff --git a/wp-assets/icon-128x128.png b/wp-assets/icon-128x128.png index a9cb631..8c0896e 100644 Binary files a/wp-assets/icon-128x128.png and b/wp-assets/icon-128x128.png differ diff --git a/wp-assets/icon-256x256.png b/wp-assets/icon-256x256.png index 0c7e7c2..aa3710e 100644 Binary files a/wp-assets/icon-256x256.png and b/wp-assets/icon-256x256.png differ