Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
9efa56c
Initial update of the previews plugin package.json for changsets.
colinmurphy Jun 25, 2025
8b3fee2
Fix changeset syntax error.
colinmurphy Jun 25, 2025
f2754dd
Removed ignore directories as not required.
colinmurphy Jun 25, 2025
4e353d3
Added Changeset
colinmurphy Jun 25, 2025
1f61f66
Fixing main package-lock.json file to get e2e tests to run.
colinmurphy Jun 25, 2025
90d2934
Merge branch 'chore-setup-release-workflow-iteration-1' of github.com…
colinmurphy Jun 25, 2025
c427ec3
Setup of docs and starting to create release process.
colinmurphy Jun 25, 2025
1b418ab
Added GH workflow for plugin releases etc. No idea until we test it w…
colinmurphy Jun 25, 2025
9d59dd5
Fixed npm issue. Updated e2e test to use cached composer directory fo…
colinmurphy Jun 25, 2025
ebb0eeb
Added Changeset
colinmurphy Jun 25, 2025
62a8db4
Delete .changeset/warm-dolphins-brake.md
colinmurphy Jun 25, 2025
01401d2
Small typo fix.
colinmurphy Jun 25, 2025
8fa9253
Merge branch 'chore-setup-release-workflow-iteration-1' of github.com…
colinmurphy Jun 25, 2025
d6322d1
Simplifying PR as we only need pre-release tags not a full release pr…
colinmurphy Jun 25, 2025
3c90f66
Fixes and inlucde updating the changeset version of the plugin.
colinmurphy Jun 25, 2025
9706b07
Fixes.
colinmurphy Jun 25, 2025
ea2411a
Reverted deleting package-lock.json as it is needed for e2e tests.
colinmurphy Jun 25, 2025
69cdb6a
Updated package name. Thanks @theodesp . Updated logic of pre-release…
colinmurphy Jun 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
],
"commit": false,
"linked": [],
"access": "public",
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"docs/",
Comment thread
colinmurphy marked this conversation as resolved.
"examples/",
"packages/"
],
"ignore": [],
"packages": [
"plugins/*"
]
],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
}
}
6 changes: 6 additions & 0 deletions .changeset/slimy-pugs-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@hwp-previews/wordpress-plugin": patch
---

chore: Initial release of hwp-previews beta release.

15 changes: 11 additions & 4 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:
branches:
- main
paths:
- "plugins/hwp-previews/**"
- 'plugins/hwp-previews/**.php'
- 'plugins/hwp-previews/**.js'
- 'plugins/hwp-previews/**.css'
- 'plugins/hwp-previews/**.json'

pull_request:
branches:
- main
Expand All @@ -29,9 +33,12 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Install composer
run: composer install
working-directory: plugins/hwp-previews
- name: Setup PHP with Cached Composer
uses: ./.github/actions/setup-php-composer
with:
php-version: 8.2
working-directory: plugins/hwp-previews
composer-options: '--no-progress --optimize-autoloader --no-dev'

- name: Install playwright browsers
run: npx playwright install --with-deps
Expand Down
146 changes: 146 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: Pre-release Tag

on:
push:
branches:
- main
paths:
- "plugins/**"

permissions:
contents: write # Allow actions to read and write repository contents
actions: read # Allow actions to read repository metadata but not write
jobs:
tag-pre-release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, json, zip

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8

- name: Get changed plugin directory
id: plugin
run: |
git fetch --prune --unshallow
plugin=$(git diff --name-only HEAD~1 HEAD | grep '^plugins/' | head -1 | cut -d/ -f2)
echo "plugin_slug=$plugin" >> $GITHUB_OUTPUT

- name: Validate plugin detection
run: |
if [ -z "${{ steps.plugin.outputs.plugin_slug }}" ]; then
echo "No plugin detected in changes"
exit 1
fi

if [ ! -d "plugins/${{ steps.plugin.outputs.plugin_slug }}" ]; then
echo "Plugin directory does not exist"
exit 1
fi

- name: Install dependencies
run: pnpm install

- name: Apply version bumps from changesets
run: pnpm changeset version

- name: Commit updated package.json and changelogs
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add .
git commit -m "chore: apply version bump from changesets" || echo "No changes to commit"
git push

- name: Read package metadata
id: metadata
run: |
PLUGIN_DIR="plugins/${{ steps.plugin.outputs.plugin_slug }}"

if [ ! -f "$PLUGIN_DIR/package.json" ]; then
echo "package.json not found in $PLUGIN_DIR"
exit 1
fi

package_name=$(jq -r '.name // empty' "$PLUGIN_DIR/package.json")
package_version=$(jq -r '.version // empty' "$PLUGIN_DIR/package.json")

if [ -z "$package_name" ] || [ "$package_name" = "null" ] || [ "$package_name" = "empty" ]; then
echo "Missing or invalid name in $PLUGIN_DIR/package.json"
exit 1
fi

if [ -z "$package_version" ] || [ "$package_version" = "null" ] || [ "$package_version" = "empty" ]; then
echo "Missing or invalid version in $PLUGIN_DIR/package.json"
exit 1
fi

echo "package_name=$package_name" >> $GITHUB_OUTPUT
echo "package_version=$package_version" >> $GITHUB_OUTPUT
echo "PLUGIN_DIR=$PLUGIN_DIR" >> $GITHUB_OUTPUT

- name: Create Git tag
run: |
TAG_NAME="${{ steps.metadata.outputs.package_name }}-${{ steps.metadata.outputs.package_version }}"

# Check if tag already exists
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists. Skipping tag creation."
exit 0
fi

git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag "$TAG_NAME"
git push origin "$TAG_NAME"

- name: Run composer install
working-directory: ${{ steps.metadata.outputs.PLUGIN_DIR }}
run: composer install --no-dev --optimize-autoloader

- name: Validate composer setup
working-directory: ${{ steps.metadata.outputs.PLUGIN_DIR }}
run: |
composer validate --no-check-publish --no-check-lock

- name: Create plugin archive
working-directory: ${{ steps.metadata.outputs.PLUGIN_DIR }}
run: |
mkdir -p plugin-build
composer archive --format=zip --file="plugin-build/${{ steps.plugin.outputs.plugin_slug }}.zip"

# Verify archive was created
if [ ! -f "plugin-build/${{ steps.plugin.outputs.plugin_slug }}.zip" ]; then
echo "Failed to create plugin archive"
exit 1
fi

echo "Archive created successfully: $(ls -lh plugin-build/${{ steps.plugin.outputs.plugin_slug }}.zip)"

- name: Upload archive to GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.metadata.outputs.package_name }}-${{ steps.metadata.outputs.package_version }}
name: "Pre-release ${{ steps.metadata.outputs.package_version }} for ${{ steps.metadata.outputs.package_name }}"
prerelease: true
files: |
${{ steps.metadata.outputs.PLUGIN_DIR }}/plugin-build/${{ steps.plugin.outputs.plugin_slug }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading