Skip to content

Commit

Permalink
feat: first release
Browse files Browse the repository at this point in the history
  • Loading branch information
lgaticaq committed Jan 29, 2020
1 parent 0b6265d commit 478eba0
Show file tree
Hide file tree
Showing 13 changed files with 462 additions and 79 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ cache:
- ~/.npm
- .nyc_output
node_js:
- "12.13.0"
- "12.14.1"
notifications:
email: false
stages:
Expand All @@ -29,7 +29,7 @@ jobs:
before_script:
- npm i -g coveralls
script:
- npx nyc check-coverage --lines 85 --per-file
- npx nyc check-coverage --lines 100 --per-file
after_success:
- npx nyc report > lcov.info
- coveralls < lcov.info
Expand Down
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
[![Maintainability](https://api.codeclimate.com/v1/badges/f84f0bcb39c9a5c5fb99/maintainability)](https://codeclimate.com/github/eclass/semantic-release-ssh-commands/maintainability)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

> [semantic-release](https://github.com/semantic-release/semantic-release) plugin to deploy app
> [semantic-release](https://github.com/semantic-release/semantic-release) plugin to deploy app with ssh commands
| Step | Description |
|--------------------|---------------------------------------------------------------------------------------------|
| `verifyConditions` | Verify the presence of the `CUSTOM_ENV` environment variable. |
| `publish` | Deploy app. |
| `verifyConditions` | Verify the presence of the `SSH_USER`, `SSH_HOST` environment variables. |
| `publish` | Deploy app over ssh. |

## Install

Expand All @@ -33,7 +33,13 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
"@eclass/semantic-release-ssh-commands"
[
"@eclass/semantic-release-ssh-commands",
{
"verifyConditionsCmd": "sh /usr/local/verifyConditionsCmd.sh",
"publishCmd": "sh /usr/local/publishCmd.sh",
}
]
]
}
```
Expand All @@ -44,7 +50,17 @@ The plugin can be configured in the [**semantic-release** configuration file](ht

| Variable | Description |
| -------------------- | ----------------------------------------------------------------- |
| `CUSTOM_ENV` | A custom env var |
| `SSH_USER` | A ssh user |
| `SSH_HOST` | A ssh host |
| `SSH_PRIVATE_KEY` | Content of private ssh key (Optional) |

### Options

| Variable | Description |
| --------- | ----------------------------------------------------------------- |
| `verifyConditionsCmd` | A command to verificate. Required. Ex: "sh /usr/local/verifyConditionsCmd.sh" |
| `publishCmd` | A command to publish new release. This step inject VERSIOn environment variable to use in you command. Required. Ex: "sh /usr/local/publishCmd.sh" |


### Examples

Expand All @@ -55,7 +71,13 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/gitlab",
"@eclass/semantic-release-ssh-commands"
[
"@eclass/semantic-release-ssh-commands",
{
"verifyConditionsCmd": "sh /usr/local/verifyConditionsCmd.sh",
"publishCmd": "sh /usr/local/publishCmd.sh",
}
]
]
}
```
Expand All @@ -65,6 +87,14 @@ The plugin can be configured in the [**semantic-release** configuration file](ht
release:
image: node:alpine
stage: release
before_script:
- apk add --no-cache git openssh-client
- mkdir -p /root/.ssh
- chmod 0700 /root/.ssh
- ssh-keyscan $SSH_HOST > /root/.ssh/known_hosts
- echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
- chmod 600 /root/.ssh/id_rsa
- echo " IdentityFile /root/.ssh/id_rsa" >> /etc/ssh/ssh_config
script:
- npx semantic-release
only:
Expand All @@ -88,6 +118,13 @@ jobs:
- stage: test
script: npm t
- stage: deploy
addons:
ssh_known_hosts: $SSH_HOST
before_deploy:
- eval "$(ssh-agent -s)"
- echo "$SSH_PRIVATE_KEY" > /tmp/deploy_rsa
- chmod 600 /tmp/deploy_rsa
- ssh-add /tmp/deploy_rsa
script: npx semantic-release

```
Expand Down
Loading

0 comments on commit 478eba0

Please sign in to comment.