This repository has been archived by the owner on Aug 13, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,6 @@ addons: | |
- git | ||
- libgnome-keyring-dev | ||
- fakeroot | ||
|
||
after_success: | ||
- ./.travis/publish.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
## version 1.0.0 | ||
## author: Ludovic Fernandez (@ldez/@ludnadez) | ||
|
||
set -e | ||
|
||
## Custom variables | ||
USER_EMAIL="<%= authorEmail %>" | ||
USER_NAME="<%= authorName %>" | ||
GIT_REPOSITORY='git@github.com:<%= githubAccount %>/<%= name %>.git' | ||
SSH_KEY_NAME="travis_rsa" | ||
AUTHORIZED_BRANCH='master' | ||
PUBLISH_TYPE=${PUBLISH_TYPE:="patch"} | ||
|
||
## Fix apm path to the Atom stable channel | ||
APM_SCRIPT_PATH=${APM_SCRIPT_PATH:="$HOME/atom/usr/bin/apm"} | ||
|
||
cd "$TRAVIS_BUILD_DIR" | ||
|
||
## Prevent publish on tags | ||
CURRENT_TAG=$(git tag --contains HEAD) | ||
|
||
if [ -n "${PUBLISH}" ] && [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$ATOM_CHANNEL" = "stable" ] && [ "$TRAVIS_BRANCH" = "$AUTHORIZED_BRANCH" ] && [ -z "$CURRENT_TAG" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] | ||
then | ||
echo 'Publishing...' | ||
else | ||
echo 'Skipping publishing' | ||
exit 0 | ||
fi | ||
|
||
## Git configuration | ||
git config --global user.email "${USER_EMAIL}" | ||
git config --global user.name "${USER_NAME}" | ||
|
||
## Loading SSH key | ||
echo "Loading key..." | ||
## TODO you must change `$encrypted_xxxx_key` and `$encrypted_xxxx_iv` | ||
openssl aes-256-cbc -K "$encrypted_xxxx_key" -iv "$encrypted_xxxx_iv" -in .travis/${SSH_KEY_NAME}.enc -out ~/.ssh/${SSH_KEY_NAME} -d | ||
eval "$(ssh-agent -s)" | ||
chmod 600 ~/.ssh/${SSH_KEY_NAME} | ||
ssh-add ~/.ssh/${SSH_KEY_NAME} | ||
|
||
## Change origin url to use SSH | ||
git remote set-url origin "${GIT_REPOSITORY}" | ||
|
||
## Force checkout master branch (because Travis uses a detached head) | ||
git checkout ${AUTHORIZED_BRANCH} | ||
|
||
## Publish | ||
"$APM_SCRIPT_PATH" login --token "${ATOM_ACCESS_TOKEN}" | ||
"$APM_SCRIPT_PATH" publish "${PUBLISH_TYPE}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# For generator's user | ||
|
||
## `readme.md` | ||
|
||
Edit `readme.md`: | ||
|
||
- change `ADD_YOUR_ID` in the AppVeyor badge. | ||
- change `YOUR_LICENSE` in the License badge. | ||
|
||
## Package publising with continuous delivery | ||
|
||
How to use [Travis CI](https://travis-ci.org) to publish package? | ||
|
||
Every merged PR is released as a new version (by default a `patch`). | ||
|
||
We use the [Travis CI UI](https://travis-ci.org/<%= githubAccount %>/<%= name %>/settings) to manage the publishing system via secure environment variables: | ||
|
||
* `PUBLISH_TYPE`: default `patch`, can be change to `minor`, `major`. | ||
* `PUBLISH`: if not defined, prevent the publishing. | ||
* `$encrypted_xxxx_key` and `$encrypted_xxxx_iv`: defined the main key and vector to encrypt the SSH key. | ||
* `ATOM_ACCESS_TOKEN`: defined the Atom token for `apm`. | ||
|
||
Active continuous delivery: | ||
|
||
* generate encrypted SSH key. | ||
* change `$encrypted_xxxx_key` and `$encrypted_xxxx_iv` in `.travis/publish.sh`. | ||
* add the SSH key to your Github account. (https://github.com/settings/keys) | ||
* add `ATOM_ACCESS_TOKEN` to [Travis CI UI](https://travis-ci.org/<%= githubAccount %>/<%= name %>/settings). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters