deploy-repo

1.0.1 • Public • Published

deploy-repo

Watch for push events to git branches

npm i -g deploy-repo

Usage

Default server https://deploy.leet.ar/v1

Configurable via env API_URL in case you self-host your own backend.

1. Create a deploy account

deploy-repo create

It will print an id and secret. Also, it creates a ~/.deploy folder.

Protect the account id, it gives read/delete capabilities on the API.

2. Go to repository settings -> Webhooks -> Add webhook

  • Set Payload URL to https://deploy.leet.ar/v1/webhooks/<account-id>
  • Set Content type to application/json.
  • Set Secret to the corresponding value.

Discard the secret value now, unless you reuse it for several repos then discard it.

3. Watch for changes on the server where you have the repository

deploy-repo watch like/example#main --script ./reload.sh --id <account-id>

API

deploy-repo create
deploy-repo list
deploy-repo delete <account-id>
deploy-repo watch <owner/repo#branch> --script <filename> --id <account-id>

Example script

#!/bin/bash

# Naive way to update the git repo
PK="/home/user/.ssh/id_example_backend"
GIT_SSH_COMMAND="ssh -i $PK -o IdentitiesOnly=yes" git pull
npm i

# Reload the service
PID=$(systemctl show --property MainPID --value example-backend)
/bin/kill -s INT $PID

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i deploy-repo

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

7.59 kB

Total Files

6

Last publish

Collaborators

  • lukks