mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
checkPlugins: Support adaptive npmpublish.yml (#4509)
This commit is contained in:
parent
b167f97048
commit
c702fdb488
4 changed files with 43 additions and 4 deletions
|
@ -79,10 +79,29 @@ fs.readdir(pluginPath, function (err, rootFiles) {
|
|||
fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
|
||||
fs.mkdirSync(pluginPath + '/.github/workflows', {recursive: true});
|
||||
fs.writeFileSync(path, npmpublish);
|
||||
hasAutoFixed = true;
|
||||
console.log("If you haven't already, setup autopublish for this plugin https://github.com/ether/etherpad-lite/wiki/Plugins:-Automatically-publishing-to-npm-on-commit-to-Github-Repo");
|
||||
} else {
|
||||
console.log('Setup autopublish for this plugin https://github.com/ether/etherpad-lite/wiki/Plugins:-Automatically-publishing-to-npm-on-commit-to-Github-Repo');
|
||||
}
|
||||
}else{
|
||||
// autopublish exists, we should check the version..
|
||||
// checkVersion takes two file paths and checks for a version string in them.
|
||||
const currVersionFile = fs.readFileSync(path, {encoding: 'utf8', flag: 'r'});
|
||||
const existingConfigLocation = currVersionFile.indexOf("##ETHERPAD_NPM_V=");
|
||||
const existingValue = parseInt(currVersionFile.substr(existingConfigLocation+17, existingConfigLocation.length));
|
||||
|
||||
const reqVersionFile = fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
|
||||
const reqConfigLocation = reqVersionFile.indexOf("##ETHERPAD_NPM_V=");
|
||||
const reqValue = parseInt(reqVersionFile.substr(reqConfigLocation+17, reqConfigLocation.length));
|
||||
|
||||
if(!existingValue || (reqValue > existingValue)){
|
||||
const npmpublish =
|
||||
fs.readFileSync('bin/plugins/lib/npmpublish.yml', {encoding: 'utf8', flag: 'r'});
|
||||
fs.mkdirSync(pluginPath + '/.github/workflows', {recursive: true});
|
||||
fs.writeFileSync(path, npmpublish);
|
||||
hasAutoFixed = true;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
|
@ -126,7 +145,7 @@ fs.readdir(pluginPath, function (err, rootFiles) {
|
|||
if(autoFix){
|
||||
let devDependencies = {
|
||||
"eslint": "^7.14.0",
|
||||
"eslint-config-etherpad": "^1.0.8",
|
||||
"eslint-config-etherpad": "^1.0.10",
|
||||
"eslint-plugin-mocha": "^8.0.0",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-prefer-arrow": "^1.2.2",
|
||||
|
|
|
@ -1,2 +1,4 @@
|
|||
cd node_modules/
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=1000" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100&page=2&" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
GHUSER=ether; curl "https://api.github.com/users/$GHUSER/repos?per_page=100&page=3&" | grep -o 'git@[^"]*' | grep /ep_ | xargs -L1 git clone
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
Explain what your plugin does and who it's useful for.
|
||||
|
||||
## Example animated gif of usage if appropriate
|
||||
![screenshot](https://user-images.githubusercontent.com/220864/99979953-97841d80-2d9f-11eb-9782-5f65817c58f4.PNG)
|
||||
|
||||
## Installing
|
||||
npm install [plugin_name]
|
||||
|
|
|
@ -4,24 +4,38 @@
|
|||
name: Node.js Package
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ether/etherpad-lite
|
||||
path: etherpad-lite
|
||||
# Work around https://github.com/actions/checkout/issues/197:
|
||||
- run: mv etherpad-lite ..
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12
|
||||
- run: cd ../etherpad-lite/src && npm ci
|
||||
- run: npm ci
|
||||
- run: npm install ep_etherpad-lite@file:../etherpad-lite/src
|
||||
- run: git diff
|
||||
- run: ls -la node_modules
|
||||
- run: ls -la node_modules/ep_etherpad-lite/node_modules
|
||||
- run: npm test
|
||||
- run: npm run lint
|
||||
|
||||
publish-npm:
|
||||
needs: build
|
||||
if: github.event_name == 'push'
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -37,3 +51,6 @@ jobs:
|
|||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
- run: git push --follow-tags
|
||||
|
||||
##ETHERPAD_NPM_V=1
|
||||
## NPM configuration automatically created using bin/plugins/updateAllPluginsScript.sh
|
||||
|
|
Loading…
Reference in a new issue