forked from vue-styleguidist/vue-styleguidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
120 lines (104 loc) · 4.11 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
language: node_js
python:
- '3.8'
# never build when commited by the bot
# + prevent double build on dev -> delivery Pull Request
if: sender != "vue-styleguidist-bot" AND sender != "Vue Styleguidist Bot" AND (type = pull_request OR branch = delivery OR branch = next)
cache:
npm: false
directories:
- '~/.pnpm-store'
before_install:
- curl -L https://unpkg.com/@pnpm/self-installer | node
- pnpm config set store-dir ~/.pnpm-store
install:
- pnpm install
# In order to avoid double build on pull requests,
# only build on pushes on delivery and on pushes on pull requests
branches:
only:
- dev
- delivery
- next
stages:
- test
- name: documentation
if: type != pull_request AND branch = delivery
- name: release-beta
if: type != pull_request AND branch = next
- name: release
if: type != pull_request AND branch = delivery
- name: merge-back
if: type != pull_request AND branch = delivery
jobs:
include:
- stage: test
script:
- pnpm lint
# Run tests with coverage
- pnpm test:jest -- --runInBand --coverage
# Upload coverage report to Codecov
- curl -s https://codecov.io/bash | bash
# Build & Deploy the documentation website
- stage: documentation
script:
- pnpm predocs
- pnpm docs:build
# Build all examples (except for docgen-nuxt which needs to be sent to surge)
- cd examples; for D in *; do if [ $D != "docgen-nuxt" ]; then cd ..; pnpm build "${D}" -- --ci; cd examples; fi; done || exit 1
# Move them to the docs (except for docgen-nuxt which needs to be sent to surge)
- for D in *; do if [ $D != "docgen-nuxt" ]; then mv "${D}"/dist ../docs/dist/"${D}"; fi; done || exit 1
deploy:
provider: pages
skip-cleanup: true
local-dir: docs/dist
target-branch: master
repo: vue-styleguidist/vue-styleguidist.github.io
github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
keep-history: true
on:
branch: delivery
- stage: release
script:
- git config --global user.name "Vue Styleguidist Bot"
- git config --global user.email "${BOT_EMAIL}"
- git remote set-url origin "https://${GH_TOKEN}@github.com/vue-styleguidist/vue-styleguidist.git" > /dev/null 2>&1
- git checkout delivery
- git reset --hard
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
- npx lerna version --yes --create-release=github
- npx lerna publish from-git --yes
- stage: release-beta
script:
- git config --global user.name "Vue Styleguidist Bot"
- git config --global user.email "${BOT_EMAIL}"
- git remote set-url origin "https://${GH_TOKEN}@github.com/vue-styleguidist/vue-styleguidist.git" > /dev/null 2>&1
- git checkout next
- git reset --hard
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
- npx lerna version -- --yes --create-release=github --conventional-prerelease --preid beta
- npx lerna publish from-git -- --yes --dist-tag next
# then merge the whole thing back to dev
- stage: merge-back
install: skip # bundle install is not required
script:
- git config --global user.name "Vue Styleguidist Bot"
- git config --global user.email "${BOT_EMAIL}"
- git checkout delivery
- pnpm i --frozen-lockfile=false
- git add pnpm-lock.yaml
- git commit --allow-empty -m "merge - update lock file after release"
- git remote add github "https://${GH_TOKEN}@github.com/vue-styleguidist/vue-styleguidist.git" > /dev/null 2>&1
# push delivery
- git fetch github delivery
- git branch --set-upstream-to github/delivery
- git push
# push dev
- git fetch github dev
- git reset --hard
- git checkout github/dev
- git checkout -b dev
- git status -v
- git merge delivery --no-edit
- git branch --set-upstream-to github/dev
- git push