|
1 | 1 | ---
|
2 |
| -description: 'Workflow explantion for Deploy Now' |
| 2 | +description: 'Workflow explanation for Deploy Now' |
3 | 3 | sidebar: 'docs'
|
4 | 4 | prev: 'apache-configuration-htaccess'
|
5 | 5 | next: 'git-integration'
|
6 | 6 | editable: true
|
7 | 7 | ---
|
8 | 8 |
|
9 |
| -# Worflow explanation |
| 9 | +# GitHub Actions in IONOS DeployNow |
| 10 | + |
| 11 | +## BUILD PROCESS |
| 12 | + |
| 13 | +### Mandatory Steps (for most projects) |
| 14 | +These are the fundamental steps that apply to most projects, regardless of the technology or framework: |
| 15 | + |
| 16 | +1. **Set up job:** |
| 17 | + - Configure the execution environment. |
| 18 | + - Mandatory for all projects, as it is necessary to prepare the environment. |
| 19 | + |
| 20 | +2. **Checkout:** |
| 21 | + - Download the source code from the repository (GitHub). |
| 22 | + - Mandatory for any project that uses continuous integration and automated deployment. |
| 23 | + |
| 24 | +3. **Install Dependencies:** |
| 25 | + - Install the necessary project dependencies (using composer, npm, yarn, pip, etc.). |
| 26 | + - Laravel and Symfony (PHP): `composer install`. |
| 27 | + - Single Page Applications (Angular, React, Vue, Svelte, Ember, Ionic): `npm install` or `yarn install`. |
| 28 | + - Static Site Generators (Gatsby, Hugo, Jekyll, etc.): Install the generator dependencies. |
| 29 | + - Mandatory for any project that requires external dependencies. |
| 30 | + |
| 31 | +4. **Build assets:** |
| 32 | + - Build the necessary assets for production, such as CSS, JavaScript, optimized images, generated HTML, etc. |
| 33 | + - Laravel/Symfony: Compile assets with tools like Laravel Mix. |
| 34 | + - SPAs (React, Vue, Angular, Svelte): Run `npm run build` to compile assets. |
| 35 | + - Static Site Generators (Hugo, Gatsby, Jekyll, Next.js, etc.): Compile static files (HTML, CSS, JS) using the corresponding generator. |
| 36 | + - Mandatory if the project requires generating an optimized production version. |
| 37 | + |
| 38 | +5. **Store deployment content:** |
| 39 | + - Store the generated or compiled files in the correct location for deployment. |
| 40 | + - Mandatory for any project where the build output is necessary for deployment. |
| 41 | + |
| 42 | +6. **Complete Job:** |
| 43 | + - Finalize the build process. |
| 44 | + - Mandatory to correctly close the CI/CD flow and proceed to deployment. |
| 45 | + |
| 46 | +### Optional Steps (depending on the project) |
| 47 | + |
| 48 | +1. **Render Templates:** |
| 49 | + - Generate custom configuration files for different environments (development, production). |
| 50 | + - Laravel/Symfony: Optional, if generating `.env` or configuration files is necessary. |
| 51 | + - Static Site Generators: Sometimes configuration files are set before the build. |
| 52 | + - SPA: Environment variables may also need to be configured. |
| 53 | + |
| 54 | +2. **Setup Composer:** |
| 55 | + - Only necessary in PHP projects (Laravel, Symfony) for managing dependencies. |
| 56 | + - Optional for any project that does not use PHP. |
| 57 | + |
| 58 | +3. **Run Composer Install:** |
| 59 | + - Run `composer install` to install dependencies in PHP projects. |
| 60 | + - Optional if not working with PHP. |
| 61 | + |
| 62 | +4. **Setup Node:** |
| 63 | + - Prepare the Node.js environment for frontend asset compilation (CSS, JS). |
| 64 | + - Mandatory for SPAs and projects using Node.js to handle frontend (React, Vue, Angular). |
| 65 | + - Optional for PHP projects or static sites that do not use Node.js. |
| 66 | + |
| 67 | +5. **Build Node Assets:** |
| 68 | + - Compile frontend assets (CSS, JS) using tools like Webpack or Gulp. |
| 69 | + - Mandatory for SPAs and projects with JavaScript-based frontend. |
| 70 | + - Optional for projects without complex frontend components or simple static sites. |
| 71 | + |
| 72 | +6. **Post Setup Node:** |
| 73 | + - Perform additional configuration or cleanup tasks after setting up Node.js. |
| 74 | + - Optional, depending on the project. |
| 75 | + - May include: removing temporary files, final adjustments to Node.js configuration. |
| 76 | + |
| 77 | +7. **Post Checkout:** |
| 78 | + - Make additional adjustments or actions after the repository has been cloned. |
| 79 | + - Optional, may be useful for running additional setup or validation scripts. |
| 80 | + |
| 81 | +8. **Tests (Not included in the Laravel flow, but important):** |
| 82 | + - Optional, but recommended for any project. |
| 83 | + - Run automated tests before proceeding to deployment. |
| 84 | + - Laravel and Symfony: Unit and functional tests with PHPUnit. |
| 85 | + - SPAs (React, Vue, Angular, Svelte, Ember): Testing with frameworks like Jest, Mocha, Cypress. |
| 86 | + - Static Site Generators: Test for broken links, accessibility, performance tests. |
| 87 | + |
| 88 | +### Optional Steps Specific to Static Site Generators and SPAs |
| 89 | +- **Hugo, Gatsby, Gridsome, Docusaurus, VuePress, VitePress, NuxtJS, NextJS (static), Hexo, Metalsmith, 11ty, UmiJS, Astro, Scully, ElderJS, Middleman, Jekyll, Nanoc, Pelican, mkdocs, Jigsaw, Sculpin:** |
| 90 | + |
| 91 | +1. **Generate Static Files:** |
| 92 | + - This step is key in these projects as it compiles all the content into static files (HTML, CSS, JS). It is equivalent to running `npm run build` to generate a site optimized for production. |
| 93 | + - Mandatory for static site generators. |
| 94 | + |
| 95 | +2. **Build Optimization:** |
| 96 | + - Performs additional optimizations like CSS/JS minification, dead code elimination, and image optimization. |
| 97 | + - Optional, but common in static site projects to improve site performance. |
| 98 | + |
| 99 | +3. **Content Validation:** |
| 100 | + - Some static site generators include content validation (e.g., checking for broken links). |
| 101 | + - Optional, depending on the generator and the tools you use. |
| 102 | + |
| 103 | +- **Angular, React, Vue, Ionic, Svelte, Ember (SPAs):** |
| 104 | + |
| 105 | +1. **Pre-rendering/SSR (Server-Side Rendering):** |
| 106 | + - Some SPA projects may include pre-rendering or server-side rendering (SSR) to improve SEO and performance. |
| 107 | + - Optional if the project supports and requires SSR (e.g., with frameworks like Next.js or Nuxt.js). |
| 108 | + |
| 109 | +2. **Progressive Web App (PWA) Build:** |
| 110 | + - Some SPA projects include an additional step to convert the application into a PWA (Progressive Web App) by adding support for cache, service workers, etc. |
| 111 | + - Optional if the project is configured to be a PWA. |
| 112 | + |
| 113 | +### Other Optional or Additional Steps Depending on the Framework |
| 114 | +- **Linting/Code Quality Checks:** |
| 115 | + - Optional, but recommended to verify code quality before the build. |
| 116 | + - Linters like ESLint or Stylelint could be run in JavaScript or TypeScript projects. |
| 117 | + |
| 118 | +- **Cache Dependencies:** |
| 119 | + - Optional, to optimize runtime for future builds. |
| 120 | + - SPAs and PHP projects: You can cache dependencies (npm, composer) to speed up the build process. |
| 121 | + |
| 122 | +- **Image Optimization:** |
| 123 | + - Optional, though recommended for projects with many static images. |
| 124 | + - Tools like imagemin can be used to optimize images during the build process. |
| 125 | + |
| 126 | +- **Deploy Content to CDN:** |
| 127 | + - In some projects, after storing the generated files, you can deploy them to a CDN to improve performance and global distribution of the content. |
| 128 | + - Optional, depending on the deployment architecture (e.g., Netlify, AWS S3, Cloudflare). |
| 129 | + |
| 130 | +## DEPLOYMENT PROCESS |
| 131 | + |
| 132 | +### Mandatory Steps (for most projects) |
| 133 | +These are the fundamental steps that apply to most projects, regardless of the technology or framework: |
| 134 | + |
| 135 | +1. **Set up deployment environment:** |
| 136 | + - Configure the deployment environment on the target server or platform. |
| 137 | + - Mandatory for all projects, as it is necessary to prepare the deployment environment (server, container, cloud platform). |
| 138 | + |
| 139 | +2. **Transfer deployment content:** |
| 140 | + - Transfer the generated or compiled files (HTML, CSS, JS, images, etc.) and dependencies to the deployment environment. |
| 141 | + - Mandatory for any project, as it is necessary to ensure the content is on the server. |
| 142 | + |
| 143 | +3. **Set up server or platform configuration:** |
| 144 | + - Configure the web server or platform (e.g., Apache, Nginx, Netlify, Vercel, etc.) to serve the application. |
| 145 | + - Mandatory, as the application needs to be accessible through a properly configured server or platform. |
| 146 | + |
| 147 | +4. **Run database migrations (if applicable):** |
| 148 | + - If the application uses a database, this step runs the migrations to update the database structure according to the new version of the code. |
| 149 | + - Laravel and Symfony (PHP): Run `php artisan migrate` (Laravel) or migration commands in Symfony. |
| 150 | + - Mandatory if the application uses databases. |
| 151 | + |
| 152 | +5. **Restart server/services (if necessary):** |
| 153 | + - Restart the web services or server to apply the new changes (Nginx, Apache, Node.js, etc.). |
| 154 | + - Mandatory in projects that need to restart the server to apply new configurations or code updates. |
| 155 | + |
| 156 | +6. **Post-deployment checks:** |
| 157 | + - Verify that the application is working correctly after deployment. |
| 158 | + - Mandatory to ensure that the deployment did not cause production errors. |
| 159 | + |
| 160 | +### Optional Steps (depending on the project) |
| 161 | + |
| 162 | +1. **Cache clearing (if necessary):** |
| 163 | + - Clear the cache on the server or platform in case updated files are still being served from the cache. |
| 164 | + - Laravel: `php artisan cache:clear` to clear view or route caches. |
| 165 | + - Optional, but recommended in cache-managing projects. |
| 166 | + |
| 167 | +2. **Configure environment variables:** |
| 168 | + - Configure environment variables for the application, such as API keys or environment-specific settings (production, development, etc.). |
| 169 | + - Laravel and Symfony: Configure environment variables in `.env` or on the server. |
| 170 | + - Optional, but necessary if the environment variables change based on the environment. |
| 171 | + |
| 172 | +3. **Purge CDN cache (if using a CDN):** |
| 173 | + - If the application is using a CDN (Content Delivery Network), purge the cache to ensure users receive the updated files. |
| 174 | + - Optional, if using a CDN like Cloudflare, AWS CloudFront, or Netlify CDN. |
| 175 | + |
| 176 | +4. **Warm up cache:** |
| 177 | + - Prepare the cache by preloading data or views to optimize the first load of the application after deployment. |
| 178 | + - Laravel: Run `php artisan optimize` to preload views. |
| 179 | + - Optional, useful in projects that use caching. |
| 180 | + |
| 181 | +5. **Backup previous deployment (optional rollback plan):** |
| 182 | + - Backup the previous version before deployment, so you can roll back if the deployment fails. |
| 183 | + - Laravel/Symfony: Backup databases and critical files. |
| 184 | + - Optional, but recommended in critical projects. |
| 185 | + |
| 186 | +6. **Notify team/monitoring tools:** |
| 187 | + - Notify the team or monitoring tools (Slack, email, Sentry, etc.) about the deployment status. |
| 188 | + - Optional, but useful for keeping the development team informed. |
| 189 | + |
| 190 | +7. **SEO checks / Lighthouse audit (for static sites or SPAs):** |
| 191 | + - Run SEO and performance audits using tools like Lighthouse. |
| 192 | + - Optional, especially relevant for static site projects or SPAs where SEO and performance are important. |
| 193 | + |
| 194 | +8. **Rollback on failure:** |
| 195 | + - If the deployment fails, revert to the previous version to avoid production errors. |
| 196 | + - Optional, but a recommended practice in any automated deployment workflow. |
| 197 | + |
| 198 | +### Optional Steps Specific to Static Site Generators and SPAs |
| 199 | + |
| 200 | +- **Hugo, Gatsby, Gridsome, Docusaurus, VuePress, VitePress, NuxtJS, NextJS (static), Hexo, Metalsmith, 11ty, UmiJS, Astro, Scully, ElderJS, Middleman, Jekyll, Nanoc, Pelican, mkdocs, Jigsaw, Sculpin:** |
| 201 | + |
| 202 | +1. **Deploy Static Files:** |
| 203 | + - Deploy the generated static files (HTML, CSS, JS) on the hosting server or platform. |
| 204 | + - Mandatory for static site generators, as it is necessary to make the site available. |
| 205 | + |
| 206 | +2. **Build Optimization:** |
| 207 | + - Perform additional optimizations during or after deployment (minifying CSS/JS, dead code elimination). |
| 208 | + - Optional, but common to improve site performance in production. |
| 209 | + |
| 210 | +3. **Content Validation:** |
| 211 | + - Perform content validation like checking for broken links, accessibility, and SEO. |
| 212 | + - Optional, depending on the static site generator. |
| 213 | + |
| 214 | +- **Angular, React, Vue, Ionic, Svelte, Ember (SPAs):** |
| 215 | + |
| 216 | +1. **Pre-rendering/SSR (Server-Side Rendering):** |
| 217 | + - Deploy the application with pre-rendering or server-side rendering to improve SEO and performance. |
| 218 | + - Optional, but recommended in SPAs using SSR (Next.js, Nuxt.js). |
| 219 | + |
| 220 | +2. **Progressive Web App (PWA) Setup:** |
| 221 | + - If the application is a PWA, configure service workers, cache, and other necessary optimizations. |
| 222 | + - Optional, only if the project is configured as a PWA. |
| 223 | + |
| 224 | +### Other Optional or Additional Steps Depending on the Framework |
| 225 | + |
| 226 | +1. **Linting/Code Quality Checks:** |
| 227 | + - Run code quality analysis tools like ESLint or Stylelint. |
| 228 | + - Optional, but recommended before deployment. |
| 229 | + |
| 230 | +2. **Monitor performance with tools:** |
| 231 | + - Monitor the application’s performance with tools like New Relic, Datadog, or Google Lighthouse. |
| 232 | + - Optional, useful for ensuring the application’s health after deployment. |
| 233 | + |
| 234 | +3. **Deploy Content to CDN:** |
| 235 | + - Deploy the static files to a CDN (Content Delivery Network) to improve global distribution and performance. |
| 236 | + - Optional, depending on the deployment architecture. |
0 commit comments