chore: improve SKILL.md error message in CI with required sections #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Launchpad | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Verify SKILL.md exists | |
| run: | | |
| if [ ! -f SKILL.md ]; then | |
| echo "" | |
| echo "❌ SKILL.md not found!" | |
| echo "" | |
| echo " Every crypto product must have SKILL.md — a guide for AI agents." | |
| echo " Create SKILL.md with these sections:" | |
| echo "" | |
| echo " ## What is this project — description, live URL, repo link" | |
| echo " ## Stack — tech stack (frontend, contracts, hosting)" | |
| echo " ## Repository structure — key files/dirs and their purpose" | |
| echo " ## Build & Deploy — build commands, CI pipeline, server paths" | |
| echo " ## Common tasks — how to add networks, update contracts, fund farms" | |
| echo " ## Troubleshooting — known errors and fixes" | |
| echo "" | |
| echo " Example: https://github.com/noxonsu/farmfactory/blob/main/SKILL.md" | |
| echo "" | |
| exit 1 | |
| fi | |
| echo "✓ SKILL.md found" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Generate version | |
| id: version | |
| run: | | |
| VERSION="2.$(date -u +%y.%m%d)" | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Generated version: $VERSION" | |
| - name: Update version in plugin files | |
| run: | | |
| # Update plugin header version | |
| sed -i "s/^ \* Version: .*/ * Version: ${{ env.VERSION }}/" lp-wp.php | |
| # Update version constant | |
| sed -i "s/define( 'ONOUT_LPWP_VER', '.*'/define( 'ONOUT_LPWP_VER', '${{ env.VERSION }}'/" lp-wp.php | |
| echo "Updated lp-wp.php:" | |
| grep -E "Version:|ONOUT_LPWP_VER" lp-wp.php | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build WordPress version (build_wp) | |
| env: | |
| CI: false | |
| run: | | |
| yarn build_wp | |
| if [ ! -d "wordpress_vendor" ]; then | |
| echo "Error: wordpress_vendor directory not found" | |
| exit 1 | |
| fi | |
| echo "✓ WordPress build completed" | |
| ls -la wordpress_vendor/ | head -10 | |
| - name: Create info.json | |
| run: | | |
| cat > info.json << EOF | |
| { | |
| "name": "LaunchPad", | |
| "version": "${{ env.VERSION }}", | |
| "tested": "6.4", | |
| "requires": "5.0", | |
| "requires_php": "7.1", | |
| "download_url": "https://farm.wpmix.net/updates/launchpad-v${{ env.VERSION }}.zip", | |
| "last_updated": "$(date -u +"%Y-%m-%d %H:%M:%S")", | |
| "sections": { | |
| "description": "Crypto launchpad platform for WordPress - create IDO pools with token lockers on EVM chains", | |
| "installation": "Upload the plugin files to /wp-content/plugins/launchpad/, then activate the plugin through the Plugins menu in WordPress", | |
| "changelog": "<h4>${{ env.VERSION }}</h4><ul><li>$(echo '${{ github.event.head_commit.message }}' | head -1)</li></ul>" | |
| } | |
| } | |
| EOF | |
| echo "Generated info.json:" | |
| cat info.json | jq . || cat info.json | |
| echo "Validating JSON..." | |
| cat info.json | jq . > /dev/null && echo "✓ Valid JSON" || (echo "✗ Invalid JSON" && exit 1) | |
| - name: Create WordPress plugin package | |
| run: | | |
| echo "Creating WordPress plugin package..." | |
| # Create package directory with plugin subdirectory (WordPress standard) | |
| mkdir -p launchpad-package/launchpad | |
| # Copy main plugin file | |
| echo "Copying main plugin file..." | |
| cp lp-wp.php launchpad-package/launchpad/ | |
| # Copy App directory (controllers) | |
| echo "Copying App directory..." | |
| cp -r App launchpad-package/launchpad/ | |
| # Copy templates directory | |
| echo "Copying templates directory..." | |
| cp -r templates launchpad-package/launchpad/ | |
| # Copy wordpress assets if exist | |
| if [ -d "wordpress/assets" ]; then | |
| echo "Copying wordpress assets..." | |
| mkdir -p launchpad-package/launchpad/assets | |
| cp -r wordpress/assets/* launchpad-package/launchpad/assets/ | |
| fi | |
| # Copy wordpress_vendor (WordPress-specific build) | |
| echo "Copying wordpress_vendor (React build)..." | |
| mkdir -p launchpad-package/launchpad/wordpress_vendor | |
| cp -r wordpress_vendor/* launchpad-package/launchpad/wordpress_vendor/ | |
| # Copy additional files if they exist | |
| if [ -f "README.md" ]; then | |
| cp README.md launchpad-package/launchpad/ | |
| fi | |
| if [ -f "LICENSE" ]; then | |
| cp LICENSE launchpad-package/launchpad/ | |
| fi | |
| # Verify structure | |
| echo "Package structure:" | |
| ls -la launchpad-package/launchpad/ | head -20 | |
| # Create ZIP (from package directory, so launchpad/ is the root in ZIP) | |
| cd launchpad-package | |
| zip -r ../launchpad-v${{ env.VERSION }}.zip launchpad | |
| cd .. | |
| # Verify ZIP | |
| if [ ! -f "launchpad-v${{ env.VERSION }}.zip" ]; then | |
| echo "Error: ZIP file not created" | |
| exit 1 | |
| fi | |
| echo "Package created: launchpad-v${{ env.VERSION }}.zip" | |
| ls -lh launchpad-v${{ env.VERSION }}.zip | |
| echo "ZIP contents:" | |
| unzip -l launchpad-v${{ env.VERSION }}.zip | head -30 | |
| - name: Upload to server | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| source: "launchpad-v${{ env.VERSION }}.zip,info.json" | |
| target: "/home/farmFactory/incoming/" | |
| - name: Update info.json on server | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| mkdir -p /var/www/html/launchpad | |
| cp /home/farmFactory/incoming/info.json /var/www/html/launchpad/info.json | |
| chmod 644 /var/www/html/launchpad/info.json | |
| echo "info.json updated" | |
| cat /var/www/html/launchpad/info.json | |
| - name: Deploy WordPress plugin ZIP to updates directory | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| # Create updates directory if it doesn't exist | |
| mkdir -p /home/farmFactory/web/farm.wpmix.net/public_html/updates | |
| # Move ZIP file from incoming to updates | |
| mv /home/farmFactory/incoming/launchpad-v${{ env.VERSION }}.zip \ | |
| /home/farmFactory/web/farm.wpmix.net/public_html/updates/ | |
| # Set permissions | |
| chmod 644 /home/farmFactory/web/farm.wpmix.net/public_html/updates/launchpad-v${{ env.VERSION }}.zip | |
| echo "WordPress plugin package deployed:" | |
| ls -lh /home/farmFactory/web/farm.wpmix.net/public_html/updates/launchpad-v${{ env.VERSION }}.zip | |
| - name: Health check | |
| run: | | |
| echo "Waiting 10 seconds for deployment to settle..." | |
| sleep 10 | |
| # Check if info.json is accessible | |
| HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" https://farm.wpmix.net/launchpad/info.json || echo "000") | |
| if [ "$HTTP_CODE" = "200" ]; then | |
| echo "✓ Health check passed (HTTP $HTTP_CODE)" | |
| else | |
| echo "⚠ Warning: Health check returned HTTP $HTTP_CODE (non-blocking)" | |
| fi | |
| - name: Notify completion | |
| if: success() | |
| run: | | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo "✓ Launchpad deployment complete" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo "Version: ${{ env.VERSION }}" | |
| echo "Package: launchpad-v${{ env.VERSION }}.zip" | |
| echo "Download: https://farm.wpmix.net/updates/launchpad-v${{ env.VERSION }}.zip" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| - name: Notify failure | |
| if: failure() | |
| run: | | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo "✗ Launchpad deployment failed" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| echo "Version: ${{ env.VERSION }}" | |
| echo "Check workflow logs for details" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" |