Skip to content

Conversation

@TheOrangePuff
Copy link
Member

Summary

🎯 Added a comprehensive Progressive Web Application deployment workflow that transforms how we deploy PWAs to AWS infrastructure

β€’ πŸ“¦ Multi-environment deployments - Support for staging, production, and preview environments with proper isolation
β€’ 🌿 Branch-based preview environments - Automatic preview deployments for pull requests with unique URLs
β€’ πŸ”„ Dual cache strategies - Smart caching with immutable assets (1 year) and revalidated HTML (1 hour)
β€’ ☁️ CloudFront integration - Automatic cache invalidation with configurable paths for instant updates
β€’ 🏷️ Multi-brand deployment support - Parallel deployment matrix for multiple brands in a single workflow
β€’ πŸ“± Node.js 16-22 compatibility - Flexible package manager support (Yarn/npm) with proper dependency caching
β€’ πŸ›‘οΈ Manual production gates - Environment-based deployment protection with approval workflows
β€’ 🧹 Artifact optimization - Intelligent cleanup and storage optimization

πŸŽͺ Key Features That Make This Awesome

Smart Caching Strategy 🧠
The workflow implements a dual cache approach:

  • Static assets (JS/CSS/images) get immutable 1-year caching for lightning-fast loading
  • HTML files get 1-hour cache with revalidation to ensure content freshness

Preview Magic ✨
Every PR automatically gets its own preview environment:

  • pr-123 or branch-feature-name prefixed deployments
  • Unique URLs for stakeholder review
  • No collision with production environments

Multi-Brand Matrix Deployment 🎭
Deploy multiple brands in parallel with a single configuration:

brand-config: '{"brand":["brand-a","brand-b","brand-c"]}'

Enterprise-Grade AWS Integration 🏒

  • S3 static hosting with proper security headers
  • CloudFront CDN for global performance
  • Configurable invalidation patterns
  • Support for signed URLs (optional)

🚦 Usage Examples

Basic Production Deployment:

uses: aligent/workflows/.github/workflows/pwa-deployment.yml@main
with:
  s3-bucket: my-production-bucket
  cloudfront-distribution-id: E1234567890ABC
  environment: production
  cache-strategy: immutable

PR Preview Environment:

uses: aligent/workflows/.github/workflows/pwa-deployment.yml@main
with:
  s3-bucket: my-preview-bucket
  cloudfront-distribution-id: E1234567890ABC
  environment: preview
  preview-mode: true
  preview-base-url: https://preview.example.com

πŸ”§ What's Under the Hood

4-Stage Pipeline Architecture:

  1. πŸ” Prepare - Validates inputs, configures cache strategies, and sets deployment paths
  2. πŸ—οΈ Build - Multi-brand matrix builds with dependency caching and test execution
  3. πŸš€ Deploy - Dual-phase S3 deployment (static assets β†’ HTML) with CloudFront invalidation
  4. 🧹 Cleanup - Automatic artifact cleanup to optimize storage costs

Input Validation & Safety:

  • Required parameter validation with clear error messages
  • Environment type checking (staging/production/preview only)
  • Cache strategy validation (immutable/no-cache)
  • Debug mode for troubleshooting deployments

Comprehensive Logging:

  • Deployment summaries in GitHub job summaries
  • Debug mode with verbose AWS CLI output
  • CloudFront invalidation tracking
  • Build artifact information

This workflow replaces ad-hoc deployment scripts and provides a standardized, battle-tested approach to PWA deployments across all our projects! πŸŽ‰

πŸ€– Generated with Claude Code

Co-Authored-By: Claude [email protected]

- Support S3 + CloudFront deployment with dual cache strategies
- Branch-based preview environments with PR URLs
- Multi-brand parallel deployment support
- CloudFront invalidation with configurable paths
- Node.js 16-22 support with Yarn/npm package managers
- Environment-specific configurations (staging/production/preview)
- Manual production deployment gates
- Artifact caching and comprehensive cleanup
- Extensive documentation with usage examples

πŸ€– Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update environment parameter description to clarify it accepts any GitHub environment name
- Remove hardcoded environment validation, rely on GitHub's environment protection rules
- Clarify that cloudfront-signing-key is already optional (no change needed)
- Multi-brand matrix build already implemented (no change needed)
- Remove cloudfront-signing-key from workflow secrets
- Update README documentation to remove the secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant