我正在使用GitLab来托管我的静态页面! 每次我配置.gitlab-ci.yml文件时,我都会收到以下错误:“无法找到Gemfile”
这里是.gitlab-ci.yml文件
image: ruby:2.3
before_script:
- bundle install
job:
script:
- gem install jekyll
- jekyll build
pages:
stage: deploy
script:
- bundle install
- bundle exec jekyll build -d public
artifacts:
paths:
- public
only:
- master
test:
stage: test
script:
- bundle install
- bundle exec jekyll build -d test
artifacts:
paths:
- test
except:
- master
答案 0 :(得分:1)
在您的配置中,我看到了不同的安装说明:
bundle install
(在before_script中)bundle install
(再次,在页面部署脚本中)gem install jekyll
Gemfile
命令需要bundle
,它应该主要指定对jekyll的依赖(所以再次重复)
建议的解决方案: 我建议您尝试使用gitlab pages sample中的配置:
gitlab-ci.yml
image: ruby:2.3
variables:
JEKYLL_ENV: production
before_script:
- bundle install
test:
stage: test
script:
- bundle exec jekyll build -d test
artifacts:
paths:
- test
except:
- master
pages:
stage: deploy
script:
- bundle exec jekyll build -d public
artifacts:
paths:
- public
only:
- master
的Gemfile
source "https://rubygems.org"
ruby RUBY_VERSION
# This will help ensure the proper Jekyll version is running.
gem "jekyll", "3.4.0"
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]