Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 25 additions & 25 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Production Build & Release

on:
push:
branches:
- main
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

jobs:
release:
name: "Update release branch"
runs-on: ubuntu-latest
steps:
- name: Check out project
uses: actions/checkout@v5
release:
name: 'Update release branch'
runs-on: ubuntu-latest
steps:
- name: Check out project
uses: actions/checkout@v5

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'

- name: Merge and build
uses: humanmade/hm-github-actions/.github/actions/build-to-release-branch@04c32a93e52ae987095f144105745a501d6207c8 # v0.2.0
with:
source_branch: main
release_branch: release
built_asset_paths: build
build_script: |
npm i
npm run build
- name: Merge and build
uses: humanmade/hm-github-actions/.github/actions/build-to-release-branch@04c32a93e52ae987095f144105745a501d6207c8 # v0.2.0
with:
source_branch: main
release_branch: release
built_asset_paths: build
build_script: |
npm i
npm run build
162 changes: 81 additions & 81 deletions .github/workflows/playwright-tests.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,86 @@
name: Playwright Tests

on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
push:
branches: [main, master, develop]
pull_request:
branches: [main, master, develop]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'

- name: Install dependencies
run: npm i

- name: Build plugin
run: npm run build

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: Start WordPress environment
run: npm run wp-env start

- name: Wait for WordPress to be ready
run: |
timeout 60 bash -c 'until curl -sSf http://localhost:8889 > /dev/null 2>&1; do sleep 2; done' || echo "WordPress may not be fully ready"
sleep 5

- name: Debug - Check WordPress status
run: |
curl -I http://localhost:8889 || echo "WordPress not responding"
docker ps

- name: Run Playwright tests
id: tests
continue-on-error: true
run: npm run test:e2e
env:
CI: true

- name: Stop WordPress environment
if: always()
run: npm run wp-env stop

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: test-results/
retention-days: 30
if-no-files-found: ignore

- name: Upload test videos and traces
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: test-results/
retention-days: 7
if-no-files-found: ignore

- name: Comment PR with test results
uses: daun/playwright-report-comment@v3
if: always() && github.event_name == 'pull_request'
with:
report-file: test-results/results.json

- name: Fail if tests failed
if: steps.tests.outcome == 'failure'
run: exit 1
test:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: 'npm'

- name: Install dependencies
run: npm i

- name: Build plugin
run: npm run build

- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium

- name: Start WordPress environment
run: npm run wp-env start

- name: Wait for WordPress to be ready
run: |
timeout 60 bash -c 'until curl -sSf http://localhost:8889 > /dev/null 2>&1; do sleep 2; done' || echo "WordPress may not be fully ready"
sleep 5

- name: Debug - Check WordPress status
run: |
curl -I http://localhost:8889 || echo "WordPress not responding"
docker ps

- name: Run Playwright tests
id: tests
continue-on-error: true
run: npm run test:e2e
env:
CI: true

- name: Stop WordPress environment
if: always()
run: npm run wp-env stop

- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: test-results/
retention-days: 30
if-no-files-found: ignore

- name: Upload test videos and traces
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: test-results/
retention-days: 7
if-no-files-found: ignore

- name: Comment PR with test results
uses: daun/playwright-report-comment@v3
if: always() && github.event_name == 'pull_request'
with:
report-file: test-results/results.json

- name: Fail if tests failed
if: steps.tests.outcome == 'failure'
run: exit 1
140 changes: 70 additions & 70 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,88 @@
name: Version and Release

on:
release:
types: [created]
release:
types: [created]

jobs:
version-and-release:
name: Update Version and Create Release Asset
runs-on: ubuntu-latest
permissions:
contents: write
version-and-release:
name: Update Version and Create Release Asset
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code at tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
steps:
- name: Checkout code at tag
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0

- name: Get version from tag
id: get_version
run: |
# Extract version from tag (remove 'v' prefix if present)
TAG_NAME="${{ github.event.release.tag_name }}"
VERSION="${TAG_NAME#v}"
- name: Get version from tag
id: get_version
run: |
# Extract version from tag (remove 'v' prefix if present)
TAG_NAME="${{ github.event.release.tag_name }}"
VERSION="${TAG_NAME#v}"

echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
echo "Tag: $TAG_NAME"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
echo "Tag: $TAG_NAME"

- name: Replace __VERSION__ in plugin file
run: |
sed -i "s/__VERSION__/${{ steps.get_version.outputs.version }}/g" hm-query-loop.php
echo "Updated plugin header:"
cat hm-query-loop.php | grep "Version:"
echo "Updated version constant:"
cat hm-query-loop.php | grep "HM_QUERY_LOOP_VERSION"
- name: Replace __VERSION__ in plugin file
run: |
sed -i "s/__VERSION__/${{ steps.get_version.outputs.version }}/g" hm-query-loop.php
echo "Updated plugin header:"
cat hm-query-loop.php | grep "Version:"
echo "Updated version constant:"
cat hm-query-loop.php | grep "HM_QUERY_LOOP_VERSION"

- name: Commit version changes to tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit version changes to tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

# Add and commit the versioned file
git add hm-query-loop.php
git commit -m "Update version to ${{ steps.get_version.outputs.version }}"
# Add and commit the versioned file
git add hm-query-loop.php
git commit -m "Update version to ${{ steps.get_version.outputs.version }}"

# Delete the old tag and create a new one pointing to the new commit
git tag -d "${{ steps.get_version.outputs.tag }}"
git tag -a "${{ steps.get_version.outputs.tag }}" -m "Release ${{ steps.get_version.outputs.tag }}"
# Delete the old tag and create a new one pointing to the new commit
git tag -d "${{ steps.get_version.outputs.tag }}"
git tag -a "${{ steps.get_version.outputs.tag }}" -m "Release ${{ steps.get_version.outputs.tag }}"

# Force push the updated tag
git push origin "${{ steps.get_version.outputs.tag }}" --force
# Force push the updated tag
git push origin "${{ steps.get_version.outputs.tag }}" --force

- name: Create ZIP archive
run: |
mkdir -p release
- name: Create ZIP archive
run: |
mkdir -p release

# Create a clean copy excluding dev files
rsync -av --exclude='.git' \
--exclude='.github' \
--exclude='node_modules' \
--exclude='src' \
--exclude='release' \
--exclude='.gitignore' \
--exclude='.gitattributes' \
--exclude='package.json' \
--exclude='package-lock.json' \
--exclude='RELEASE.md' \
./ release/hm-query-loop/
# Create a clean copy excluding dev files
rsync -av --exclude='.git' \
--exclude='.github' \
--exclude='node_modules' \
--exclude='src' \
--exclude='release' \
--exclude='.gitignore' \
--exclude='.gitattributes' \
--exclude='package.json' \
--exclude='package-lock.json' \
--exclude='RELEASE.md' \
./ release/hm-query-loop/

# Create ZIP
cd release
zip -r "hm-query-loop-${{ steps.get_version.outputs.tag }}.zip" hm-query-loop/
cd ..
# Create ZIP
cd release
zip -r "hm-query-loop-${{ steps.get_version.outputs.tag }}.zip" hm-query-loop/
cd ..

echo "Created: release/hm-query-loop-${{ steps.get_version.outputs.tag }}.zip"
echo "Created: release/hm-query-loop-${{ steps.get_version.outputs.tag }}.zip"

- name: Upload ZIP to release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
release/hm-query-loop-${{ steps.get_version.outputs.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload ZIP to release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.event.release.tag_name }}
files: |
release/hm-query-loop-${{ steps.get_version.outputs.tag }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading