GitHubCIProcess
This commit is contained in:
Родитель
0ebdab4de9
Коммит
359eeef60f
|
@ -0,0 +1,31 @@
|
|||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
types: [opened, closed, edited, synchronize]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install
|
||||
run: npm i
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
|
||||
name: Node.js CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: set environment variables
|
||||
uses: allenevans/set-env@v1.0.0
|
||||
with:
|
||||
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
|
||||
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
|
||||
GIT_MAIL: ${{ secrets.USER_MAIL }}
|
||||
|
||||
- name: Install
|
||||
run: npm i
|
||||
|
||||
- name: Get changed files
|
||||
run: |
|
||||
git diff --name-only HEAD^ HEAD
|
||||
|
||||
- name: Publish
|
||||
run: npm run publish
|
||||
env:
|
||||
GIT_USER: ${{ secrets.WEB_GITLAB_USER }}
|
||||
GIT_TOKEN: ${{ secrets.WEB_GITLAB_TOKEN }}
|
||||
GIT_MAIL: ${{ secrets.USER_MAIL }}
|
|
@ -0,0 +1,88 @@
|
|||
var fs = require('fs');
|
||||
var gulp = require('gulp');
|
||||
var glob = require('glob');
|
||||
var shelljs = require('shelljs');
|
||||
var path = require('path');
|
||||
var branch = 'master';
|
||||
var user = process.env.GIT_USER;
|
||||
var token = process.env.GIT_TOKEN;
|
||||
var user_mail = process.env.GIT_MAIL;
|
||||
var is_temp = process.env.IS_TEMP;
|
||||
var changedFileNames;
|
||||
var changes;
|
||||
/**
|
||||
* Source shipping to gitlab
|
||||
*/
|
||||
gulp.task('ship-to-gitlab', function (done) {
|
||||
changedFileNames = changedFileNameList();
|
||||
console.log('--changedFileNames----' + changedFileNames);
|
||||
var gitPath = 'https://' + user + ':' + token + `@gitlab.syncfusion.com/content/Flutter-docs`;
|
||||
console.log('Clone has been started...!');
|
||||
var clone = shelljs.exec('git clone ' + gitPath + ' -b ' + branch + ' ' + `../../../gitlabRepo/Flutter-docs`, {
|
||||
silent: false
|
||||
});
|
||||
if (clone.code !== 0) {
|
||||
console.log(clone.stderr);
|
||||
done();
|
||||
return;
|
||||
} else {
|
||||
console.log('Clone has been completed...!');
|
||||
// update src from github to gitlab - replace files from cloned repo
|
||||
|
||||
for (var changedFileName of changedFileNames.split(',')) {
|
||||
|
||||
if (changedFileName !== null && changedFileName !== '') {
|
||||
|
||||
if (fs.existsSync('../Flutter-docs/' + changedFileName)) {
|
||||
// It will update the modified files
|
||||
if (fs.existsSync('../../../gitlabRepo/Flutter-docs/' + changedFileName)) {
|
||||
shelljs.cp('-rf', `../Flutter-docs/` + changedFileName, `../../../gitlabRepo/Flutter-docs/` + changedFileName);
|
||||
}
|
||||
else {
|
||||
// It will update the newly added files
|
||||
if (fs.existsSync('../../../gitlabRepo/Flutter-docs/')) {
|
||||
shelljs.cp('-rf', `../Flutter-docs/` + changedFileName, `../../../gitlabRepo/Flutter-docs/` + changedFileName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// It will remove the deleted files
|
||||
if (fs.existsSync('../../../gitlabRepo/Flutter-docs/' + changedFileName)) {
|
||||
shelljs.rm('-rf', `../../../gitlabRepo/Flutter-docs/` + changedFileName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
shelljs.cd(`../../../gitlabRepo/Flutter-docs`);
|
||||
shelljs.exec('git add .');
|
||||
shelljs.exec('git pull');
|
||||
shelljs.exec('git commit -m \"source updation from github repo \" --no-verify');
|
||||
shelljs.exec('git push');
|
||||
shelljs.cd('../../');
|
||||
}
|
||||
})
|
||||
|
||||
// Controls List
|
||||
function changedFileNameList() {
|
||||
shelljs.exec(`git config --global user.email "${user_mail}"`);
|
||||
shelljs.exec(`git config --global user.name "${user}"`);
|
||||
changes = shelljs.exec(`git diff --name-status HEAD^ HEAD`);
|
||||
var controls = '';
|
||||
var changesList = changes.stdout.split('\n');
|
||||
if (changesList !== null && changesList !== '') {
|
||||
for (var comp of changesList) {
|
||||
controls += comp.replace(/A\s+/g, "").replace(/M\s+/g, "").replace(/D\s+/g, "").replace(/R100\s+/g, "").split(/\s+/g) + ',';
|
||||
}
|
||||
return controls;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
"name": "@Syncfusion/Flutter-docs",
|
||||
"version": "1.0.0",
|
||||
"description": "Syncfusion TypeScript common documentation",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"core-js": "^2.5.7",
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-csslint": "^1.0.1",
|
||||
"gulp-csslint-report": "^2.0.0",
|
||||
"gulp-gzip": "^1.4.2",
|
||||
"lodash": "^4.17.11",
|
||||
"markdownlint": "^0.11.0",
|
||||
"markdown-link-extractor": "^1.2.0",
|
||||
"markdown-spellcheck": "^1.3.1",
|
||||
"prismjs": "^1.15.0",
|
||||
"require-dir": "^1.0.0",
|
||||
"shelljs": "^0.8.2",
|
||||
"styled-components": "^3.4.9",
|
||||
"typeface-merriweather": "0.0.43",
|
||||
"typeface-montserrat": "0.0.43",
|
||||
"typo-js": "^1.0.3",
|
||||
"typescript": "^2.6.2",
|
||||
"typography": "^0.16.17",
|
||||
"typography-theme-wordpress-2016": "^0.15.10",
|
||||
"webpack": "4.28.4",
|
||||
"terser": "3.14.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-plugin-react": "^7.11.1",
|
||||
"gh-pages": "^1.2.0",
|
||||
"json-loader": "^0.5.7",
|
||||
"prettier": "^1.14.2"
|
||||
},
|
||||
"config": {
|
||||
"ghooks": {
|
||||
"pre-commit": "gulp test"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"publish": "gulp ship-to-gitlab"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче