forked from vue-styleguidist/vue-styleguidist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
137 lines (119 loc) · 4.55 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
language: node_js
python:
- "3.6"
# 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:
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:
- delivery
- next
- dev
stages:
- test
- coverage
- name: docgen-nuxt
if: type != pull_request AND branch = delivery
- 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
- stage: docgen-nuxt
script:
- pnpm build docgen-nuxt
# deploy nuxt-content separately because of routing conflicts
deploy:
provider: surge
skip_cleanup: true
project: ./examples/docgen-nuxt/dist/
domain: nuxt-content-styleguidist.surge.sh
on:
branch: delivery
# 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