首頁>技術>

image: node:latest stages:  - install  - test  - build-dist # 在流水線中使用package.json快取node_modules,只要package.json內容沒變就一直使用快取cache:  key:    files:      - package.json  paths:    - node_modules # 定義安裝npm包的jobinstall:  stage: install  script:    - npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/    - npm install --registry=http://registry.npm.taobao.org # 定義程式碼驗證的jobcode-lint:  stage: test  script:    - npm run lint  allow_failure: true # 執行失敗,程式碼驗證失敗後仍然會執行後續job # 編譯生成檔案的jobbuild-dist:  stage: build-dist  before_script:    - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'    - eval $(ssh-agent -s)    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -    - mkdir -p ~/.ssh    - chmod 700 ~/.ssh     - ssh-keyscan 115.159.52.223 >> ~/.ssh/known_hosts    - chmod 644 ~/.ssh/known_hosts  script:    - npm run build    - scp -r dist [email protected]:/usr/local/www  artifacts:    paths:      - dist  only: # 只在master分支編譯,為了能夠    - master

usr/local/www : 伺服器nginx代理指向的目錄

SSH_PRIVATE_KEY: 免密登入的私鑰

使用公有runner

8
最新評論
  • BSA-TRITC(10mg/ml) TRITC-BSA 牛血清白蛋白改性標記羅丹明
  • 一個簡單的html+js的打飛機遊戲