Skip to content

Commit 764d61a

Browse files
committed
artifacts for distribution
1 parent deb447d commit 764d61a

File tree

10 files changed

+1813
-5
lines changed

10 files changed

+1813
-5
lines changed

.distignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Files to exclude from WordPress.org distribution
2+
3+
# Development files
4+
/.git
5+
/.github
6+
/node_modules
7+
/test-app
8+
/src
9+
10+
# Build tools
11+
/webpack.config.js
12+
/tsconfig.json
13+
/package.json
14+
/package-lock.json
15+
/pnpm-lock.yaml
16+
/.nvmrc
17+
18+
# Development scripts
19+
/package.sh
20+
21+
# Environment files
22+
/.env
23+
/.env.example
24+
25+
# Documentation (keep README.md, remove development docs)
26+
/CLAUDE.md
27+
/CONTRIBUTING.md
28+
29+
# Testing files
30+
/tests
31+
/.phpunit.result.cache
32+
33+
# IDE files
34+
/.vscode
35+
/.idea
36+
*.sublime-project
37+
*.sublime-workspace
38+
39+
# OS files
40+
.DS_Store
41+
Thumbs.db
42+
*.swp
43+
*.swo
44+
45+
# Logs
46+
*.log
47+
npm-debug.log*
48+
yarn-debug.log*
49+
yarn-error.log*
50+
51+
# Temporary files
52+
*.tmp
53+
*.temp
54+
/tmp
55+
56+
# Git files
57+
.gitignore
58+
.gitattributes
59+
60+
# CI/CD
61+
/.travis.yml
62+
/.circleci
63+
/phpcs.xml
64+
/phpunit.xml

.github/workflows/build.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
name: Build Plugin
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Setup pnpm
26+
uses: pnpm/action-setup@v2
27+
with:
28+
version: 8
29+
30+
- name: Get pnpm store directory
31+
id: pnpm-cache
32+
shell: bash
33+
run: |
34+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
35+
36+
- name: Setup pnpm cache
37+
uses: actions/cache@v3
38+
with:
39+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
40+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
41+
restore-keys: |
42+
${{ runner.os }}-pnpm-store-
43+
44+
- name: Install dependencies
45+
run: pnpm install --frozen-lockfile
46+
47+
- name: Build frontend assets
48+
run: pnpm run build
49+
50+
- name: Verify build output
51+
run: |
52+
if [ ! -f "build/index.tsx.js" ]; then
53+
echo "Error: Build failed - build/index.tsx.js not found"
54+
exit 1
55+
fi
56+
if [ ! -f "build/index.tsx.asset.php" ]; then
57+
echo "Error: Build failed - build/index.tsx.asset.php not found"
58+
exit 1
59+
fi
60+
echo "✅ Build successful!"
61+
ls -lh build/
62+
63+
- name: Check plugin file syntax
64+
run: |
65+
# Check PHP syntax
66+
if command -v php &> /dev/null; then
67+
echo "Checking PHP syntax..."
68+
find . -name "*.php" -not -path "./vendor/*" -not -path "./node_modules/*" -exec php -l {} \; | grep -v "No syntax errors"
69+
else
70+
echo "PHP not installed, skipping syntax check"
71+
fi
72+
73+
- name: Build Summary
74+
run: |
75+
echo "### Build Status ✅" >> $GITHUB_STEP_SUMMARY
76+
echo "" >> $GITHUB_STEP_SUMMARY
77+
echo "All checks passed!" >> $GITHUB_STEP_SUMMARY
78+
echo "" >> $GITHUB_STEP_SUMMARY
79+
echo "**Build Artifacts:**" >> $GITHUB_STEP_SUMMARY
80+
echo "- \`build/index.tsx.js\` ($(du -h build/index.tsx.js | cut -f1))" >> $GITHUB_STEP_SUMMARY
81+
echo "- \`build/index.tsx.asset.php\`" >> $GITHUB_STEP_SUMMARY
82+
83+
- name: Upload build artifacts
84+
uses: actions/upload-artifact@v3
85+
with:
86+
name: build-artifacts
87+
path: build/
88+
retention-days: 7

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # Trigger on version tags like v1.0.0
7+
8+
jobs:
9+
build-and-release:
10+
name: Build and Release Plugin
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: write # Required for creating releases
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Extract version from tag
21+
id: get_version
22+
run: |
23+
VERSION=${GITHUB_REF#refs/tags/v}
24+
echo "version=$VERSION" >> $GITHUB_OUTPUT
25+
echo "Building version: $VERSION"
26+
27+
- name: Setup Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: '20'
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v2
34+
with:
35+
version: 8
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Build frontend assets
41+
run: pnpm run build
42+
43+
- name: Verify build output
44+
run: |
45+
if [ ! -f "build/index.tsx.js" ]; then
46+
echo "Error: Build failed - build/index.tsx.js not found"
47+
exit 1
48+
fi
49+
echo "Build successful!"
50+
51+
- name: Create distribution package
52+
run: |
53+
PLUGIN_SLUG="thirdweb-woocommerce-checkout"
54+
VERSION="${{ steps.get_version.outputs.version }}"
55+
BUILD_DIR="dist/$PLUGIN_SLUG"
56+
57+
# Create build directory
58+
mkdir -p "$BUILD_DIR"
59+
60+
# Copy plugin files
61+
cp thirdweb-woocommerce-checkout.php "$BUILD_DIR/"
62+
cp readme.txt "$BUILD_DIR/"
63+
cp README.md "$BUILD_DIR/"
64+
cp LICENSE "$BUILD_DIR/"
65+
cp .env.example "$BUILD_DIR/"
66+
67+
# Copy directories
68+
cp -r includes "$BUILD_DIR/"
69+
cp -r build "$BUILD_DIR/"
70+
cp -r assets "$BUILD_DIR/"
71+
72+
# Clean up
73+
find "$BUILD_DIR" -name ".DS_Store" -delete
74+
find "$BUILD_DIR" -name "*.log" -delete
75+
76+
# Create ZIP
77+
cd dist
78+
zip -r "${PLUGIN_SLUG}-${VERSION}.zip" "$PLUGIN_SLUG"
79+
cd ..
80+
81+
echo "Package created: dist/${PLUGIN_SLUG}-${VERSION}.zip"
82+
ls -lh dist/*.zip
83+
84+
- name: Generate changelog
85+
id: changelog
86+
run: |
87+
# Extract changelog for this version from readme.txt
88+
VERSION="${{ steps.get_version.outputs.version }}"
89+
90+
# Get the changelog section
91+
CHANGELOG=$(awk "/^= $VERSION /{flag=1; next} /^= [0-9]/{flag=0} flag" readme.txt | sed 's/^[[:space:]]*//')
92+
93+
if [ -z "$CHANGELOG" ]; then
94+
CHANGELOG="Release version $VERSION"
95+
fi
96+
97+
# Save to file for release notes
98+
echo "$CHANGELOG" > CHANGELOG.txt
99+
echo "Changelog extracted"
100+
101+
- name: Create GitHub Release
102+
uses: softprops/action-gh-release@v1
103+
with:
104+
name: Version ${{ steps.get_version.outputs.version }}
105+
body_path: CHANGELOG.txt
106+
files: |
107+
dist/thirdweb-woocommerce-checkout-${{ steps.get_version.outputs.version }}.zip
108+
draft: false
109+
prerelease: false
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Build Summary
114+
run: |
115+
echo "### Release Created! 🚀" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
echo "**Version:** ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
118+
echo "**Plugin:** thirdweb Stablecoin Checkout for WooCommerce" >> $GITHUB_STEP_SUMMARY
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
echo "**Next Steps:**" >> $GITHUB_STEP_SUMMARY
121+
echo "- ✅ GitHub Release created with ZIP file" >> $GITHUB_STEP_SUMMARY
122+
echo "- 📦 Download the ZIP from the [Releases page](https://github.com/${{ github.repository }}/releases)" >> $GITHUB_STEP_SUMMARY
123+
echo "- 🔍 Test the plugin on a staging site" >> $GITHUB_STEP_SUMMARY
124+
echo "- 📝 Update WordPress.org SVN repository (manual step)" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)