Compare commits
9 Commits
feature/re
...
fix/v0.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d4ce64c1c | ||
|
|
c24259f1d7 | ||
|
|
6ab828087d | ||
|
|
79259bf5ac | ||
|
|
deadccc27b | ||
|
|
05cb3caf0d | ||
|
|
21d05427d8 | ||
|
|
9c59fe6706 | ||
|
|
e0fcace223 |
73
.github/workflows/deploy.yml
vendored
73
.github/workflows/deploy.yml
vendored
@@ -7,67 +7,84 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# Cancel previous deploys if a new push arrives while one is running.
|
||||
concurrency:
|
||||
group: deploy-peptide-repo-core
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
# ── Run CI first ─────────────────────────────────────────────────
|
||||
ci:
|
||||
name: Pre-deploy CI
|
||||
uses: ./.github/workflows/ci.yml
|
||||
|
||||
# ── Deploy via rsync over SSH ────────────────────────────────────
|
||||
deploy:
|
||||
deploy-staging:
|
||||
name: Deploy to Staging
|
||||
needs: ci
|
||||
name: Deploy to Production
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
environment: staging
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup SSH key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
|
||||
- name: Deploy via rsync
|
||||
- name: Deploy via rsync → staging
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
--exclude '.git' \
|
||||
--exclude '.github' \
|
||||
--exclude 'tests' \
|
||||
--exclude 'phpunit.xml.dist' \
|
||||
--exclude 'composer.json' \
|
||||
--exclude 'composer.lock' \
|
||||
--exclude 'vendor' \
|
||||
--exclude 'phpcs.xml.dist' \
|
||||
--exclude 'ARCHITECTURE.md' \
|
||||
--exclude 'CONVENTIONS.md' \
|
||||
--exclude 'CHANGELOG.md' \
|
||||
--exclude '.git' --exclude '.github' \
|
||||
--exclude 'tests' --exclude 'phpunit.xml.dist' \
|
||||
--exclude 'composer.json' --exclude 'composer.lock' \
|
||||
--exclude 'vendor' --exclude 'phpcs.xml.dist' \
|
||||
--exclude 'ARCHITECTURE.md' --exclude 'CONVENTIONS.md' --exclude 'CHANGELOG.md' \
|
||||
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }}" \
|
||||
./ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/peptiderepo.com/public_html/staging/wp-content/plugins/peptide-repo-core/
|
||||
- name: Staging health check
|
||||
run: |
|
||||
sleep 5
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://staging.peptiderepo.com/ || echo "000")
|
||||
echo "Staging responded: HTTP $STATUS"
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: rm -f ~/.ssh/deploy_key
|
||||
|
||||
deploy-production:
|
||||
name: Deploy to Production
|
||||
needs: [ci, deploy-staging]
|
||||
runs-on: ubuntu-latest
|
||||
environment: production
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup SSH key
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
||||
chmod 600 ~/.ssh/deploy_key
|
||||
ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||
- name: Deploy via rsync → production
|
||||
run: |
|
||||
rsync -avz --delete \
|
||||
--exclude '.git' --exclude '.github' \
|
||||
--exclude 'tests' --exclude 'phpunit.xml.dist' \
|
||||
--exclude 'composer.json' --exclude 'composer.lock' \
|
||||
--exclude 'vendor' --exclude 'phpcs.xml.dist' \
|
||||
--exclude 'ARCHITECTURE.md' --exclude 'CONVENTIONS.md' --exclude 'CHANGELOG.md' \
|
||||
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }}" \
|
||||
./ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/peptiderepo.com/public_html/wp-content/plugins/peptide-repo-core/
|
||||
|
||||
- name: Purge LiteSpeed Cache
|
||||
run: |
|
||||
ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }} \
|
||||
${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} \
|
||||
"cd ~/domains/peptiderepo.com/public_html && find wp-content/litespeed/ -type f -delete 2>/dev/null; touch .lscache_purge 2>/dev/null || true"
|
||||
|
||||
- name: Health check
|
||||
- name: Production health check
|
||||
run: |
|
||||
sleep 5
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://peptiderepo.com)
|
||||
if [ "$STATUS" != "200" ] && [ "$STATUS" != "403" ]; then
|
||||
echo "ERROR: Site returned unexpected HTTP $STATUS after deploy"
|
||||
echo "ERROR: Site returned HTTP $STATUS"
|
||||
exit 1
|
||||
fi
|
||||
echo "Site is responsive (HTTP $STATUS)"
|
||||
|
||||
echo "Production healthy (HTTP $STATUS)"
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: rm -f ~/.ssh/deploy_key
|
||||
|
||||
11
CHANGELOG.md
11
CHANGELOG.md
@@ -3,6 +3,17 @@
|
||||
All notable changes to Peptide Repo Core are documented here.
|
||||
Format: [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [0.3.2] — 2026-04-25
|
||||
|
||||
### Fixed
|
||||
- Remove `rest_namespace` from peptide CPT registration. Custom namespace prevented Gutenberg block editor from loading peptide posts for editing (404 on wp/v2 REST route). All 89 peptide entries are now editable in the block editor. (#5)
|
||||
|
||||
## [0.3.1] — 2026-04-24
|
||||
|
||||
### Fixed
|
||||
- Add missing `PR_Core_Related_Posts_Provider` interface file (`class-pr-core-related-posts-provider.php`).
|
||||
Omitted from v0.3.0 deploy caused a fatal on every page load. Site was down until this fix.
|
||||
|
||||
## [0.3.0] — 2026-04-24
|
||||
|
||||
### Added
|
||||
|
||||
24
includes/core/class-pr-core-related-posts-provider.php
Normal file
24
includes/core/class-pr-core-related-posts-provider.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Contract for any provider that retrieves posts related to a peptide.
|
||||
*
|
||||
* What: Interface defining the get_posts() contract for related-post providers.
|
||||
* Who calls it: PR_Core_Related_Posts_Section accepts any implementation.
|
||||
* Dependencies: None.
|
||||
*
|
||||
* @see includes/core/class-pr-core-internal-posts-provider.php — default implementation.
|
||||
* @see includes/core/class-pr-core-related-posts-section.php — consumer.
|
||||
*/
|
||||
interface PR_Core_Related_Posts_Provider {
|
||||
|
||||
/**
|
||||
* Get posts related to a peptide.
|
||||
*
|
||||
* @param int $peptide_id The peptide post ID.
|
||||
* @param int $limit Maximum number of posts to return.
|
||||
* @return array<int, \WP_Post> Array of WP_Post objects (may be empty).
|
||||
*/
|
||||
public function get_posts( int $peptide_id, int $limit ): array;
|
||||
}
|
||||
@@ -184,7 +184,8 @@ class PR_Core_Peptide_CPT {
|
||||
'show_in_nav_menus' => true,
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'peptides',
|
||||
'rest_namespace' => 'pr-core/v1',
|
||||
// 'rest_namespace' omitted — custom namespaces break Gutenberg
|
||||
// (it fetches wp/v2 hardcoded). WordPress defaults to wp/v2. (#5)
|
||||
'menu_position' => 25,
|
||||
'menu_icon' => 'dashicons-database',
|
||||
'capability_type' => 'post',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Plugin Name: Peptide Repo Core
|
||||
* Plugin URI: https://peptiderepo.com
|
||||
* Description: Canonical peptide schema — shared data layer for the peptiderepo.com ecosystem. Provides the peptide CPT, dosing rows, legal status cells, AI candidate queue, disclaimer component, and JSON-LD output.
|
||||
* Version: 0.3.0
|
||||
* Version: 0.3.2
|
||||
* Author: peptiderepo
|
||||
* Author URI: https://peptiderepo.com
|
||||
* License: GPL-2.0-or-later
|
||||
@@ -22,7 +22,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
|
||||
/* ── Constants ────────────────────────────────────────────────────────── */
|
||||
|
||||
define( 'PR_CORE_VERSION', '0.3.0' );
|
||||
define( 'PR_CORE_VERSION', '0.3.2' );
|
||||
define( 'PR_CORE_PLUGIN_FILE', __FILE__ );
|
||||
define( 'PR_CORE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
define( 'PR_CORE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* - TAX_FAMILY constant is removed.
|
||||
* - register_peptide_post_type() guard: no-op when post_type_exists returns true.
|
||||
* - register_peptide_post_type() payload: args match the harmonized contract
|
||||
* (thumbnail in supports, rewrite slug peptides, pr-core/v1 REST namespace).
|
||||
* (thumbnail in supports, rewrite slug peptides, rest_namespace absent — Gutenberg requires wp/v2).
|
||||
* - register_taxonomies() guard: no-op when taxonomy_exists returns true.
|
||||
* - register_taxonomies() only registers peptide_category; pr_peptide_family is gone.
|
||||
*
|
||||
@@ -65,7 +65,7 @@ pr_assert_equals( true, $args['public'] ?? null, 'public = true' );
|
||||
pr_assert_equals( true, $args['publicly_queryable'] ?? null, 'publicly_queryable = true' );
|
||||
pr_assert_equals( true, $args['show_in_rest'] ?? null, 'show_in_rest = true' );
|
||||
pr_assert_equals( 'peptides', $args['rest_base'] ?? null, 'rest_base = "peptides"' );
|
||||
pr_assert_equals( 'pr-core/v1', $args['rest_namespace'] ?? null, 'rest_namespace = "pr-core/v1"' );
|
||||
pr_assert( ! array_key_exists( 'rest_namespace', $args ), 'rest_namespace absent — defaults to wp/v2 (Gutenberg requirement)' );
|
||||
pr_assert_equals( 'post', $args['capability_type'] ?? null, 'capability_type = "post"' );
|
||||
pr_assert_equals( true, $args['map_meta_cap'] ?? null, 'map_meta_cap = true' );
|
||||
pr_assert_equals( false, $args['hierarchical'] ?? null, 'hierarchical = false' );
|
||||
|
||||
Reference in New Issue
Block a user