Last active
April 18, 2017 16:40
-
-
Save HoverBaum/524528aec1032b29669fe9cc82dba066 to your computer and use it in GitHub Desktop.
Travis config to deploy a Hexo based site using FTP.
This file contains hidden or 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
# FTP deploy Hexo based site using Travis-ci.org | |
# https://gist.github.com/HoverBaum/524528aec1032b29669fe9cc82dba066 | |
# | |
# 1. Copy this file to the root of your repository, then rename it to '.travis.yml' | |
# 2. Replace 'YOUR NAME' and 'YOUR EMAIL' | |
# 3. Create "Environment Variables" in travis. Make sure to not show them in the output. | |
# - FTP_USER: The username for FTP transfer. | |
# - FTP_PASSWORD: Password for the user. | |
# 4. Replace "DOMAIN.TLD" with your FTP domain and maybe the path where to put things. | |
# | |
# This should also work with other static site generators. Just replace hexo | |
# with your generator. | |
language: node_js | |
node_js: | |
- "6" | |
# Only build the master branch. | |
branches: | |
only: | |
- master | |
before_install: | |
- npm install -g hexo | |
install: | |
- npm install | |
# Notice: Replace 'YOUR NAME' and 'YOUR EMAIL'. | |
before_script: | |
- git config --global user.name 'YOUR NAME' | |
- git config --global user.email 'YOUR EMAIL' | |
# Generate static files. | |
script: | |
- hexo generate | |
# Upload site using FTP. | |
# -exec must be closed with ";" which must be escaped (hence the "s). | |
# Finds all files and calls curl to upload them for every file. | |
after_success: | |
'find public -type f -exec curl -u $FTP_USER:$FTP_PASSWORD --ftp-create-dirs -T {} ftp://DOMAIN.TLD/{} ";"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment