2017-03-21 33 views
1

我的最終目標是能夠在我的Jekyll博客上安排發佈內容。我使用Travis-CI將/ _site /的內容部署到S3存儲桶中,只要我在Github中提交給我的主分支。Travis-CI:S3部署腳本不會添加新文件

Travis-CI流程按預期工作,但是由於新建的頁面沒有構建並添加到/ _site /目錄,除非我在本地構建我的站點並直接將新/ _site /文件夾推送到主站。這些帖子出現在/ _posts /中,但是不會像每天重建網站時那樣自動生成並添加到/ _site /中。

我的travis.yml文件如下。

language: ruby 
rvm: 
- 2.3.3 

# before_script: 
# - chmod +x ./script/cibuild # or do this locally and commit 

# Assume bundler is being used, therefore 
# the `install` step will run `bundle install` by default. 
install: gem install jekyll html-proofer jekyll-twitter-plugin 
script: jekyll build && htmlproofer ./_site 

# branch whitelist, only for GitHub Pages 
branches: 
    only: 
    - master 

env: 
    global: 
    - NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer 

exclude: [vendor] 

sudo: false # route your build to the container-based infrastructure for a faster build 

deploy: 
    provider: s3 
    access_key_id: $AWS_ACCESS_KEY 
    secret_access_key: $AWS_SECRET_KEY 
    bucket: $S3_BUCKET 
    local_dir: _site 

回答

1

我想到了這一點:Travis-CI部署寶石不包括構建步驟。它只是推動回購的內容到S3。我更新了我的構建腳本,作爲構建和驗證步驟的一部分。