2017-08-24 4 views
1

Salut J'ai besoin d'un peu d'aide pour configurer mon déploiement travis ci.Travis CI déployer le fichier de construction non en git repo

Je pense que la source du problème est que dans le repo de github je n'ai pas le fichier de construction que je veux déployer. Comme dans .gitignore fichier j'ai dossier build/ où ma génération est générée.

fichier .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 

Je sais que je devrais avoir un code dans le fichier travis sous before_install, mais comme je ne suis pas familier avec bash, je ne sais pas comment correctement référence uniquement le fichier .dmg de mon dossier build. (build/*.dmg)

Comme je l'ai dit, le dossier de construction est exclu du repo git.

erreur Travis CI-journal est:

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/[email protected]{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 

Répondre

0

Voir https://docs.travis-ci.com/user/deployment/s3.

L'exemple précédent n'est presque certainement pas idéal, car vous souhaiterez probablement télécharger vos fichiers binaires et votre documentation. Définissez skip_cleanup sur true pour empêcher Travis CI de supprimer vos artefacts de construction.

+0

cela a fonctionné! Cependant, après avoir pointé vers une extension de fichier spécifique build/*. Dmg, il se casse encore. Une idée de ça? – desicne

+1

'local_dir' prend clairement un nom de répertoire, pas un motif glob. Dans 'before_deploy', soit: a) vous voudriez créer un répertoire dans lequel vous déplaceriez les fichiers' build/*. Dmg' (et ajustez la valeur 'local_dir' en conséquence); ou b) supprime tous les fichiers dans 'build' qui ne correspondent pas au modèle. – banzaiman