Travis CI 部署构建文件不在 git 仓库中
Travis CI deploy build file not in git repo
嗨,我需要一些帮助来设置我的 travis ci 部署。
我认为问题的根源在于 github 存储库中我没有要部署的构建文件。正如在 .gitignore
文件中一样,我有 build/
生成我的构建的文件夹。
.travis.yml
文件
osx_image: xcode8.3
sudo: required
dist: trusty
language: c
matrix:
include:
- os: osx
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1
compiler: clang
cache:
directories:
- node_modules
- "$HOME/.electron"
- "$HOME/.cache"
addons:
apt:
packages:
- libgnome-keyring-dev
- icnsutils
before_install:
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
"$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
| tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends
-y icnsutils graphicsmagick xz-utils; fi
install:
- nvm install 7
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g xvfb-maybe
- yarn
script:
- yarn run build
branches:
only:
- master
deploy:
provider: s3
access_key_id: MY_ACCESS_KEY_ID
secret_access_key:
secure: MY_SECURE_ACCESS_SECRET
bucket: MY_AWS_BUCKET
local-dir: build/*
acl: bucket_owner_full_control
on:
repo: MY_GITHUB_REPO
env:
matrix:
secure: MY_GITHUB_TOKEN
我知道我应该在 before_install
下的 travis 文件中有一些代码,但正如我不熟悉 bash,我不知道如何正确地仅引用 [=18] =] 文件从我的 build
文件夹。 (build/*.dmg
)
正如我所说,构建文件夹已从 git 存储库中排除。
Travis-CI 错误日志为:
HEAD detached at ca6dfb3
Untracked files:
(use "git add <file>..." to include in what will be committed)
yarn.lock
nothing added to commit but untracked files present (use "git add" to track)
Dropped refs/stash@{0} (8ab81738da8330c59a8d91b0b3cef454b607dd3d)
/Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:47:in `chdir': No such file or directory @ dir_chdir - build/*.dmg (Errno::ENOENT)
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:47:in `push_app'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider.rb:154:in `block in deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:41:in `fold'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider.rb:154:in `deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:75:in `deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:32:in `run'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:7:in `run'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/bin/dpl:5:in `<top (required)>'
from /Users/travis/.rvm/gems/ruby-2.4.1/bin/dpl:23:in `load'
from /Users/travis/.rvm/gems/ruby-2.4.1/bin/dpl:23:in `<main>'
failed to deploy
/Users/travis/.travis/job_stages: line 878: shell_session_update: command not found
见https://docs.travis-ci.com/user/deployment/s3。
The previous example is almost certainly not ideal, as you probably want to upload your built binaries and documentation. Set skip_cleanup
to true
to prevent Travis CI from deleting your build artifacts.
嗨,我需要一些帮助来设置我的 travis ci 部署。
我认为问题的根源在于 github 存储库中我没有要部署的构建文件。正如在 .gitignore
文件中一样,我有 build/
生成我的构建的文件夹。
.travis.yml
文件
osx_image: xcode8.3
sudo: required
dist: trusty
language: c
matrix:
include:
- os: osx
- os: linux
env: CC=clang CXX=clang++ npm_config_clang=1
compiler: clang
cache:
directories:
- node_modules
- "$HOME/.electron"
- "$HOME/.cache"
addons:
apt:
packages:
- libgnome-keyring-dev
- icnsutils
before_install:
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([
"$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz
| tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install --no-install-recommends
-y icnsutils graphicsmagick xz-utils; fi
install:
- nvm install 7
- curl -o- -L https://yarnpkg.com/install.sh | bash
- source ~/.bashrc
- npm install -g xvfb-maybe
- yarn
script:
- yarn run build
branches:
only:
- master
deploy:
provider: s3
access_key_id: MY_ACCESS_KEY_ID
secret_access_key:
secure: MY_SECURE_ACCESS_SECRET
bucket: MY_AWS_BUCKET
local-dir: build/*
acl: bucket_owner_full_control
on:
repo: MY_GITHUB_REPO
env:
matrix:
secure: MY_GITHUB_TOKEN
我知道我应该在 before_install
下的 travis 文件中有一些代码,但正如我不熟悉 bash,我不知道如何正确地仅引用 [=18] =] 文件从我的 build
文件夹。 (build/*.dmg
)
正如我所说,构建文件夹已从 git 存储库中排除。
Travis-CI 错误日志为:
HEAD detached at ca6dfb3
Untracked files:
(use "git add <file>..." to include in what will be committed)
yarn.lock
nothing added to commit but untracked files present (use "git add" to track)
Dropped refs/stash@{0} (8ab81738da8330c59a8d91b0b3cef454b607dd3d)
/Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:47:in `chdir': No such file or directory @ dir_chdir - build/*.dmg (Errno::ENOENT)
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:47:in `push_app'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider.rb:154:in `block in deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:41:in `fold'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider.rb:154:in `deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/provider/s3.rb:75:in `deploy'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:32:in `run'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/lib/dpl/cli.rb:7:in `run'
from /Users/travis/.rvm/gems/ruby-2.4.1/gems/dpl-1.8.40/bin/dpl:5:in `<top (required)>'
from /Users/travis/.rvm/gems/ruby-2.4.1/bin/dpl:23:in `load'
from /Users/travis/.rvm/gems/ruby-2.4.1/bin/dpl:23:in `<main>'
failed to deploy
/Users/travis/.travis/job_stages: line 878: shell_session_update: command not found
见https://docs.travis-ci.com/user/deployment/s3。
The previous example is almost certainly not ideal, as you probably want to upload your built binaries and documentation. Set
skip_cleanup
totrue
to prevent Travis CI from deleting your build artifacts.