# Deployment

> This page documents the release process and deployment strategies for the Aegis theme, from development to production.

## Release Process

### Versioning

Aegis follows semantic versioning (SemVer):

| Type | Format | When |
| --- | --- | --- |
| Patch | 1.0.x | Bug fixes, documentation updates |
| Minor | 1.x.0 | New features, backwards compatible |
| Major | x.0.0 | Breaking changes, major rewrites |

### Release Workflow

1. **Feature development** — Work happens on feature branches.
2. **Pull request** — Submit PR to `develop` branch.
3. **Code review** — PR is reviewed by maintainers.
4. **CI passes** — All tests, linting, and checks must pass.
5. **Merge to develop** — PR is merged into the development branch.
6. **Release preparation** — When ready, `develop` is merged to `main`.
7. **Version bump** — Update version numbers in `style.css`, `package.json`, and `readme.txt`, and update `CHANGELOG.md`.
8. **Tag** — Push a tag in the form `v1.2.3` (or `v1.2.3-rc1`).
9. **Automated build** — The tag starts the release workflow (`release.yml`), which builds and uploads the package (see below).
10. **Publish** — Review the draft release on GitHub and publish it. Sites update only after the release is published.

The Aegis Dash is released separately from its own repository.

### The Release Workflow (`release.yml`)

Pushing a `v*` tag runs **Release Aegis Theme**:

1. Checks that the tag is semantic (`v1.2.3` or `v1.2.3-rc1`).
2. Runs `npm ci` and `npm run build` (Node 20).
3. Installs Composer dependencies with dev packages (PHP 8.3) and runs `npm run lint:js`, `npm run lint:css`, `vendor/bin/phpcs`, and `composer validate --strict`.
4. Reinstalls Composer dependencies with `--no-dev --optimize-autoloader`.
5. Copies the theme into an `aegis/` folder with `rsync`, skipping everything in `.distignore`.
6. Checks that `aegis/style.css`, `functions.php`, `vendor/autoload.php`, `screenshot.png`, and `src/Blocks/` exist, and that `tools/`, `vendor/aegis/wpaudit/`, `languages/`, and `LICENSE` are **not** in the package.
7. Zips it as `aegis.zip` (the zip’s root folder is `aegis/`) and writes `aegis.zip.sha256`.
8. Creates a **draft** GitHub release with both files attached and generated release notes.

The theme’s GitHub updater installs the `aegis.zip` asset from the latest **published** release, so a draft is never offered to sites. Keep the asset name `aegis.zip` and the `aegis/` root folder: the updater and the upload installer both rely on them. See [Updating](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/updating/).

### Holding a release until Aegis Dash is ready

If a theme release needs a newer Aegis Dash, add a line like this to the release notes before publishing:

```
Requires Aegis Dash: 1.1.0
```

Sites whose Aegis Dash is missing, inactive or older than that version are not offered the update, and an admin notice explains why. The updater reads the running plugin’s version, so it does not matter what the plugin folder is called. is accepted as well.

### Building a Release Package Locally

There is no `npm run package` script. To reproduce the workflow’s package on your machine:

```
# Ensure clean stategit checkout maingit pull origin main# Build assets and install production dependenciesnpm cinpm run buildcomposer install --no-dev --optimize-autoloader# Copy into an aegis/ folder, skipping .distignore entries, then zip itrsync -am ./ aegis/ --exclude-from='.distignore'zip -r aegis.zip aegis
```

`.distignore` keeps these out of the package, among others:

- `node_modules/`, `tests/`, `.git/`, and CI configuration
- `docs/`, `tools/`, `build/`, `languages/`, and `LICENSE`
- Build configuration (`package.json`, `webpack.config.js`, `composer.json`, `phpcs.xml`)
- TypeScript and SCSS sources and source maps in `src/Blocks/`
- Development-only Composer packages in `vendor/`

## Server Deployment

### Requirements

| Requirement | Details |
| --- | --- |
| PHP | 8.1 or later |
| WordPress | 7.0 or later |
| `vendor/` directory | Must be present (Composer production dependencies) |
| Compiled block assets | Must be present in `src/Blocks/` (built by `npm run build`) |

### Deployment via Upload

1. Download the release `aegis.zip`.
2. Upload through **Appearance → Themes → Add New → Upload**.
3. Activate the theme.

### Deployment via Git

For servers with Git access:

```
cd wp-content/themes/aegisgit fetch origingit checkout v1.0.0  # specific release tagcomposer install --no-dev --optimize-autoloader
```

> [!NOTE]
> Running `npm run build` on the server is not recommended. Always deploy pre-built assets.

### Deployment via CI/CD

Automated deployment pipeline example:

```
deploy:  steps:    - checkout code    - composer install --no-dev --optimize-autoloader    - npm ci    - npm run build    - rsync to production (excluding dev files)    - clear caches
```

### Files to Deploy

| Include | Exclude |
| --- | --- |
| `src/` (PHP, plus compiled block JS/CSS and `block.json` in `src/Blocks/`) | `node_modules/` |
| `vendor/` (no-dev) | `tests/` |
| `assets/` (fonts, icons, images) | `.git/`, CI configuration |
| `parts/` | `build/`, `tools/`, `docs/` |
| `patterns/` | `webpack.config.js`, `eslint.config.cjs`, `tsconfig.json` |
| `styles/` | `phpcs.xml` |
| `templates/` | `composer.json`, `composer.lock`, `package.json` |
| `theme.json`, `style.css`, `functions.php`, `index.php`, `embed-content.php`, `screenshot.png`, `readme.txt` | `.wp-env.json`, `.editorconfig` |

`.distignore` is the full exclusion list.

### Deployment Checklist

Before deploying to production:

- [ ] All tests pass.
- [ ] Build completes without errors.
- [ ] Version numbers are updated.
- [ ] Changelog is updated.
- [ ] `composer install --no-dev` (no development packages).
- [ ] `npm run build` (production build, not `build:dev`).
- [ ] No source maps in production (unless intentional).
- [ ] Backup the production site.

## Post-Deployment

After deploying a new version:

1. **Clear caches** — Purge page cache, object cache, and CDN cache.
2. **Verify the site** — Check the homepage, key pages, and WooCommerce.
3. **Check the error log** — Look for any new PHP errors or warnings.
4. **Test critical paths** — Complete a test purchase (if WooCommerce), submit a form.
5. **Run a Lighthouse audit** — Ensure performance did not regress.

## Rollback Procedure

If a deployment causes issues:

### Via Theme Upload

1. Download the `aegis.zip` of the previous release.
2. Upload and activate the previous version.

### Via Git

```
cd wp-content/themes/aegisgit checkout v1.0.0-previous  # previous release tagcomposer install --no-dev --optimize-autoloader
```

### Via Backup

Restore the full site backup taken before deployment.

## Environment-Specific Configuration

### Development

```
define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'SCRIPT_DEBUG', true );
```

### Staging

```
define( 'WP_DEBUG', true );define( 'WP_DEBUG_LOG', true );define( 'SCRIPT_DEBUG', false );
```

### Production

```
define( 'WP_DEBUG', false );define( 'SCRIPT_DEBUG', false );
```

## CDN Considerations

When using a CDN:

- Ensure the CDN serves the theme’s `src/Blocks/`, `vendor/aegis/*/public/`, and `assets/` files.
- Set appropriate cache headers for versioned assets (long TTL).
- Purge CDN cache after deployment.
- Fonts and images should be served via CDN for performance.

## Next Steps

- [Contributing](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/contributing/) — How to contribute changes.
- [Building Assets](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/building-assets/) — Understanding the build output.
- [Performance](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/performance/) — Post-deployment performance verification.
- [Common Issues](https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/common-issues/) — Troubleshooting deployment problems.

---

Source: https://www.atmostfear-entertainment.com/docs/aegis/themes/theme/deployment/ · Updated 2026-11-24
