能够使用阶段将页面部署到Travis中的GitHub。
失败,我必须没有合适的合成器,否则就不可能。
来源:
项目:
这项用于构建没有阶段的页面的工作:See the passing travis job : travis-ci.org/kopax/deleteme/builds/380660202:
dist: trusty
# Blocklist
branches:
except:
- gh-pages # will be deployed to, no need to build it
cache:
directories:
- node_modules
node_js:
- "10"
before_install:
- npm install -g npm
# const
- export PACKAGE_NAME=$(node -p "require('./package.json').name")
- export PACKAGE_VERSION=$(node -p "require('./package.json').version")
- export NODE_VERSION=$(node --version)
- export NPM_VERSION=$(npm --version)
# logging
- npm --version || echo npm not installed
- node --version|| echo node not installed
- npx rollup-umd-scripts --version || echo npx not installed
- echo "package version $PACKAGE_VERSION"
language: node_js
sudo: required
script:
# execute all of the commands which need to be executed
# before running actual tests
- npm run styleguide:build
deploy:
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN # Set in the settings page of your repository, as a secure variable
keep_history: true
local_dir: public/
on:
branch: master
但是,如果将Page deployement添加为阶段See this failed travis job: travis-ci.org/kopax/deleteme/jobs/380983577,则会失败:
language: node_js
sudo: required
#env:
# global:
# - DISPLAY=:99.0
# - NODE_ENV=test
dist: trusty
# Blocklist
branches:
except:
- gh-pages # will be deployed to, no need to build it
cache:
directories:
- node_modules
node_js:
- "10"
before_install:
- npm install -g npm
# const
- export PACKAGE_NAME=$(node -p "require('./package.json').name")
- export PACKAGE_VERSION=$(node -p "require('./package.json').version")
- export NODE_VERSION=$(node --version)
- export NPM_VERSION=$(npm --version)
# logging
- npm --version || echo npm not installed
- node --version|| echo node not installed
- npx rollup-umd-scripts --version || echo npx not installed
- echo "package version $PACKAGE_VERSION"
stages:
- build
- test
- release
- deploy
script:
# execute all of the commands which need to be executed
# before running actual tests
- npm run styleguide:build
jobs:
include:
# Job: Build
- stage: build
node_js:
- lts/*
# - 10
# - 8
script:
- npm run build
branches:
only:
- release
- dev
- master
# Job: Test
- stage: test
node_js:
- lts/*
# - 10
# - 8
script:
- npm run test
branches:
only:
- release
- dev
- master
# Job: Release
- stage: release
node_js:
- lts/*
skip_cleanup: true
script:
- npx semantic-release
branches:
only:
- master
# Job: Page
- stage: deploy
provider: pages
skip_cleanup: true
github_token: $GH_TOKEN # Set in the settings page of your repository, as a secure variable
keep_history: true
local_dir: public/
on:
branch: master
有人知道如何在Travis中使用页面进行阶段部署吗?
答案 0 :(得分:3)
您的部署阶段没有定义安装/脚本,因此它采用默认安装/脚本。
你需要在舞台上定义你想要做什么,你忘记了deploy
级别。
要仅具有部署的专用阶段,请按以下方式进行配置:
- stage: deploy
if: type = push AND branch = master # or whenever you want to deploy
script: skip # to not run Travis' default script
deploy: # <-- that was missing !!!
- provider: pages
skip_cleanup: true
github_token: $GH_TOKEN # Set in the settings page of your repository, as a secure variable
keep_history: true
local_dir: public/