UnlyEd / next-right-now

Flexible production-grade boilerplate with Next.js 11, Vercel and TypeScript. Includes multiple opt-in presets using Storybook, Airtable, GraphQL, Analytics, CSS-in-JS, Monitoring, End-to-end testing, Internationalization, CI/CD and SaaS B2B multi single-tenancy (monorepo) support
https://unlyed.github.io/next-right-now/
MIT License
1.27k stars 110 forks source link

Optimize CI/CD by running actions only when related files have been changed #266

Closed Vadorequest closed 3 years ago

Vadorequest commented 3 years ago

Is your feature request related to a problem? Please describe. Optimize the heavy deploy-vercel-staging/production.yml workflows by running them only when related files have been changed.

Describe the solution you'd like Ignore run when:

Basically, ignoring those files (or, allowing other files only) would avoid deploying needlessly, which would result in faster deployments, reduced feedback of what really matters, and lowering costs (GHA, Vercel)

Additional context

We've done something similar for storybook, using paths, basically using a "whitelist" and ignoring other changes:

on:
  push: # Triggers on each pushed commit
    branches:
      - '*'
    # Only run the workflow when there are changes made to files, in any of the below paths
    # Optimize our CI/CD by not running Storybook needlessly (faster deploy, lower cost)
    paths:
      - '.github/workflows/deploy-vercel-storybook.yml'
      - '.storybook/**'
      - 'cypress/integration-storybook/**'
      - 'src/stories/**'
      - 'src/components/**'
      #      - 'src/*/components/**' # For later?
      - 'package.json'
Vadorequest commented 3 years ago

Done in https://github.com/UnlyEd/next-right-now/pull/282