Skip to content

Commit fcf45e8

Browse files
Merge pull request syncfusion#1 from syncfusion/GitHubCIProcess
GitHubCIProcess
2 parents 69ce816 + 42498ee commit fcf45e8

File tree

5 files changed

+220
-0
lines changed

5 files changed

+220
-0
lines changed

.github/workflows/node.js.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
pull_request:
8+
branches: [ master ]
9+
types: [opened, closed, edited, synchronize]
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [10.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
with:
23+
fetch-depth: 2
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
29+
- name: Install
30+
run: npm i
31+

.github/workflows/publish.js.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [10.x]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 2
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v1
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: set environment variables
29+
uses: allenevans/set-env@v1.0.0
30+
with:
31+
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
32+
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
33+
GIT_MAIL: ${{ secrets.USER_MAIL }}
34+
35+
- name: Install
36+
run: npm i
37+
38+
- name: Get changed files
39+
run: |
40+
git diff --name-only HEAD^ HEAD
41+
42+
- name: Publish
43+
run: npm run publish
44+
env:
45+
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
46+
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
47+
GIT_MAIL: ${{ secrets.USER_MAIL }}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.npmrc
2+
dist/
3+
.vscode/
4+
coverage/
5+
index.js
6+
index.d.ts
7+
gulpfile.js
8+
node_modules/

gulpfile.js

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
var fs = require('fs');
2+
var gulp = require('gulp');
3+
var glob = require('glob');
4+
var shelljs = require('shelljs');
5+
var path = require('path');
6+
var branch = 'master';
7+
var user = process.env.GIT_USER;
8+
var token = process.env.GIT_TOKEN;
9+
var user_mail = process.env.GIT_MAIL;
10+
var is_temp = process.env.IS_TEMP;
11+
var changedFileNames;
12+
var changes;
13+
/**
14+
* Source shipping to gitlab
15+
*/
16+
gulp.task('ship-to-gitlab', function (done) {
17+
changedFileNames = changedFileNameList();
18+
console.log('--changedFileNames----' + changedFileNames);
19+
var gitPath = 'https://' + user + ':' + token + `@gitlab.syncfusion.com/content/javascript-docs`;
20+
console.log('Clone has been started...!');
21+
var clone = shelljs.exec('git clone ' + gitPath + ' -b ' + branch + ' ' + `../../../gitlabRepo/javascript-docs`, {
22+
silent: false
23+
});
24+
if (clone.code !== 0) {
25+
console.log(clone.stderr);
26+
done();
27+
return;
28+
} else {
29+
console.log('Clone has been completed...!');
30+
// update src from github to gitlab - replace files from cloned repo
31+
32+
for (var changedFileName of changedFileNames.split(',')) {
33+
34+
if (changedFileName !== null && changedFileName !== '') {
35+
36+
if (fs.existsSync('../javascript-docs/' + changedFileName)) {
37+
// It will update the modified files
38+
if (fs.existsSync('../../../gitlabRepo/javascript-docs/' + changedFileName)) {
39+
shelljs.cp('-rf', `../javascript-docs/` + changedFileName, `../../../gitlabRepo/javascript-docs/` + changedFileName);
40+
}
41+
else {
42+
// It will update the newly added files
43+
if (fs.existsSync('../../../gitlabRepo/javascript-docs/')) {
44+
shelljs.cp('-rf', `../javascript-docs/` + changedFileName, `../../../gitlabRepo/javascript-docs/` + changedFileName);
45+
}
46+
}
47+
48+
}
49+
else {
50+
// It will remove the deleted files
51+
if (fs.existsSync('../../../gitlabRepo/javascript-docs/' + changedFileName)) {
52+
shelljs.rm('-rf', `../../../gitlabRepo/javascript-docs/` + changedFileName);
53+
54+
}
55+
}
56+
57+
}
58+
59+
}
60+
61+
shelljs.cd(`../../../gitlabRepo/javascript-docs`);
62+
shelljs.exec('git add .');
63+
shelljs.exec('git pull');
64+
shelljs.exec('git commit -m \"source updation from github repo \" --no-verify');
65+
shelljs.exec('git push');
66+
shelljs.cd('../../');
67+
}
68+
})
69+
70+
// Controls List
71+
function changedFileNameList() {
72+
shelljs.exec(`git config --global user.email "${user_mail}"`);
73+
shelljs.exec(`git config --global user.name "${user}"`);
74+
changes = shelljs.exec(`git diff --name-status HEAD^ HEAD`);
75+
var controls = '';
76+
var changesList = changes.stdout.split('\n');
77+
if (changesList !== null && changesList !== '') {
78+
for (var comp of changesList) {
79+
controls += comp.replace(/A\s+/g, "").replace(/M\s+/g, "").replace(/D\s+/g, "").replace(/R100\s+/g, "").split(/\s+/g) + ',';
80+
}
81+
return controls;
82+
}
83+
}
84+
85+
86+
87+
88+

package.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"name": "@Syncfusion/javascript-docs",
3+
"version": "1.0.0",
4+
"description": "Syncfusion TypeScript common documentation",
5+
"author": "Syncfusion Inc.",
6+
"license": "UNLICENSED",
7+
"dependencies": {
8+
"core-js": "^2.5.7",
9+
"cheerio": "^1.0.0-rc.2",
10+
"gulp": "^3.9.1",
11+
"gulp-csslint": "^1.0.1",
12+
"gulp-csslint-report": "^2.0.0",
13+
"gulp-gzip": "^1.4.2",
14+
"lodash": "^4.17.11",
15+
"markdownlint": "^0.11.0",
16+
"markdown-link-extractor": "^1.2.0",
17+
"markdown-spellcheck": "^1.3.1",
18+
"prismjs": "^1.15.0",
19+
"require-dir": "^1.0.0",
20+
"shelljs": "^0.8.2",
21+
"styled-components": "^3.4.9",
22+
"typeface-merriweather": "0.0.43",
23+
"typeface-montserrat": "0.0.43",
24+
"typo-js": "^1.0.3",
25+
"typescript": "^2.6.2",
26+
"typography": "^0.16.17",
27+
"typography-theme-wordpress-2016": "^0.15.10",
28+
"webpack": "4.28.4",
29+
"terser": "3.14.1"
30+
},
31+
"devDependencies": {
32+
"eslint": "^4.19.1",
33+
"eslint-plugin-react": "^7.11.1",
34+
"gh-pages": "^1.2.0",
35+
"json-loader": "^0.5.7",
36+
"prettier": "^1.14.2"
37+
},
38+
"config": {
39+
"ghooks": {
40+
"pre-commit": "gulp test"
41+
}
42+
},
43+
"scripts": {
44+
"publish": "gulp ship-to-gitlab"
45+
}
46+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy