capsulajs / capsulajs-ci-cd

MIT License
0 stars 0 forks source link

New command: deploy #2

Open MikeSquall opened 5 years ago

MikeSquall commented 5 years ago

What

Create a CLI tool for deploying easily some code to one or several targets.

Why

Writing everything by hand is time consuming. Writing everything by hand several times increases risk of mistake. Maintaining consistency across repositories and updating them is a pain.

How

The deploy command will use some standalone scripts to deploy on specific targets. Scripts could be preset, local or remote and are specified in configuration file.

Example: deploy using Travis

capsula-ci-cd deploy --branch-name $TRAVIS_BRANCH --is-pr $TRAVIS_PULL_REQUEST

The deployment will be performed for each element in targets.

"capsula-ci-cd": {
    "targets": [
      {
        "name":"npm",
        "preset": "npm"
      },
      {
        "name": "customCdnUrl",
        "path": "https://mycdn.com/sdfhwoejiwo948"
      },
      {
        "name": "customCdnScript",
        "path": "./scripts/my-custom-script.sh"
      }
    ]
  }

Each script will require some environment variables to be able to run. Example : npm preset needs $NPM_TOKEN to be able to perform npm publish

stephanebenayoun commented 5 years ago
stephanebenayoun commented 5 years ago

The deployment logic will be: on commit in a Pull Request, it will deploy a snapshot version with the version, the branch name and the timestamp on commit in develop branch, it will update the patch version number and deploy it Merging or commiting on master should generate a new minor or major version and will be handled manually (at least for now).

This is script logic and should not affect the deploy command