Skip to content

Commit f723215

Browse files
committed
Updated: circle ci config to use workflows.
1 parent ff2278a commit f723215

File tree

1 file changed

+71
-7
lines changed

1 file changed

+71
-7
lines changed

.circleci/config.yml

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@ version: 2
22

33
jobs:
44
build:
5-
branches:
6-
ignore:
7-
- gh-pages
85
docker:
96
- image: circleci/node:10
107
working_directory: ~/repo
11-
environment:
12-
- SOURCE_BRANCH: master
13-
- TARGET_BRANCH: gh-pages
148
steps:
159
- checkout
1610
- restore_cache:
@@ -24,6 +18,14 @@ jobs:
2418
key: v1-dependencies-{{ checksum "package.json" }}
2519
- run: npm test
2620
- run: npm run build
21+
deploy:
22+
docker:
23+
- image: circleci/node:10
24+
working_directory: ~/repo
25+
environment:
26+
- SOURCE_BRANCH: master
27+
- TARGET_BRANCH: gh-pages
28+
steps:
2729
- deploy:
2830
name: Deploy to Github Pages
2931
command: |
@@ -46,4 +48,66 @@ jobs:
4648
git add -A
4749
git commit -m "Deployed: website to Github Pages (automatic): ${CIRCLE_SHA1}" --allow-empty
4850
git push -q https://${GH_TOKEN}@github.com/developersdo/opensource.git $TARGET_BRANCH
49-
fi
51+
fi
52+
scrape:
53+
docker:
54+
- image: circleci/node:10
55+
working_directory: ~/repo
56+
environment:
57+
- SOURCE_BRANCH: master
58+
- TARGET_BRANCH: gh-pages
59+
steps:
60+
- run:
61+
name: Scraping Github data
62+
command: |
63+
if [ $CIRCLE_BRANCH == $SOURCE_BRANCH ]; then
64+
git config --global user.email $GH_EMAIL
65+
git config --global user.name $GH_NAME
66+
67+
npm run refresh
68+
69+
git add -A
70+
git commit -m "Updated: Github data (automatic): ${CIRCLE_SHA1}" --allow-empty
71+
git push -q https://${GH_TOKEN}@github.com/developersdo/opensource.git $SOURCE_BRANCH
72+
fi
73+
74+
workflows:
75+
version: 2
76+
build_scrape_and_deploy_daily:
77+
jobs:
78+
- build
79+
- scrape:
80+
requires:
81+
- build
82+
- deploy:
83+
requires:
84+
- scrape
85+
triggers:
86+
- schedule:
87+
cron: "0 0 * * *"
88+
filters:
89+
branches:
90+
only:
91+
- master
92+
build:
93+
jobs:
94+
- build:
95+
filters:
96+
branches:
97+
ignore:
98+
- gh-pages
99+
- master
100+
build_and_deploy:
101+
jobs:
102+
- build:
103+
filters:
104+
branches:
105+
only:
106+
- master
107+
- deploy:
108+
requires:
109+
- build
110+
filters:
111+
branches:
112+
only:
113+
- master

0 commit comments

Comments
 (0)