Git Product home page Git Product logo

deploy's Introduction

Deploy

Set of deployment tasks for Shipit in combination with internal Ghost projects.

Install

Install this package:

npm install @tryghost/deploy --save

Add a shipitfile.js config with the following content. Keep in mind that it is never a good idea to commit private credentials to git. Private settings could for example be provided by using environment variables (process.env.ENV_VARIABLE).

function init(shipit) {
  require('ghost-deploy')(shipit);

  shipit.initConfig({
    default: {
      workspace: './deploy',
      deployTo: '/opt/deploy_to',
      ignores: ['.git', 'node_modules'],
      sharedLinks: [{
        name: 'node_modules',
        type: 'directory'
      }, {
        name: 'config.production.json',
        type: 'file'
      }]
    },
    staging: {
      servers: '<user>@<server>'
    }
  });

  ...

}
module.exports = init;

And add a new script to your package.json file:

  "scripts": {
    ...,
    "deploy": "shipit"
  },

Usage

Deploy

To deploy a project to the server configured as staging execute the following command:

yarn deploy <environment>

Example: yarn deploy staging

Custom Tasks

If you need special tasks within your project it is possible to add new task in shipitfile.js.

function init(shipit) {
  require('ghost-deploy')(shipit);

  ...

  shipit.task('pwd', function () {
    return shipit.remote('pwd');
  });

}
module.exports = init;

You would then execute this task using

yarn deploy <environment> <task>

E.g.

yarn deploy staging pwd

(Note: deploy is the default task, so by default you don't have to provide a task)

The example shows how to execute the pwd command on the remote server. Visit https://github.com/shipitjs/shipit for more information about how to write custom tasks.

Events

Deploy emits one event (deployed) at the moment. This event can be used to trigger follow up actions to a successful deployment. The following example shows how the pwd command can be executed when the deployed event is emitted.

function init(shipit) {
  require('@tryghost/deploy')(shipit);

  ...

  shipit.on('deployed', function () {
    return shipit.remote('pwd').then(function () {
      shipit.log('Done!');
    });
  });

}
module.exports = init;

Use cases for events are for example database migrations that are executed after deploying new code.

Development

Testing

  • yarn lint runs eslint

Publish

  • yarn ship

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license. Ghost and the Ghost Logo are trademarks of Ghost Foundation Ltd. Please see our trademark policy for info on acceptable usage.

deploy's People

Contributors

aileen avatar cobbspur avatar daniellockyer avatar erisds avatar johnonolan avatar kirrg001 avatar renovate-bot avatar sebgie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deploy's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

Renovate tried to run on this repository, but found these problems.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
package.json
  • bluebird 3.7.2
  • lodash 4.17.20
  • shipit-cli 5.1.0
  • eslint 4.18.2
  • eslint-plugin-ghost 1.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.