diff --git a/actions/publish.yml b/actions/publish.yml index 484cc0d..5dff563 100755 --- a/actions/publish.yml +++ b/actions/publish.yml @@ -1,51 +1,76 @@ -name: Publish to neurolibre.com +name: deploy-book + on: push: + branches: + - master + # If your git repository has the Jupyter Book within some-subfolder next to + # unrelated files, you can make this run only if a file within that specific + # folder has been modified. + # + # paths: + # - content/** tags: - - "pub-v*" + - "v*" env: PUB_NAME: ${{ github.event.repository.name }} jobs: - dispatch2Website: + + deploy-book: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Install dependencies + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + pip install -r build-requirements.txt + + # Build the page + - name: Build the book + run: | + jupyter-book build content/ + + # Push the book's HTML to github-pages + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./content/_build/html + commit_message: 🤖 Deploy Jupyter Book + + publish: + + name: Publish to website + needs: [deploy-book] + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') runs-on: ubuntu-latest steps: - name: Checkout publication repository uses: actions/checkout@v2 - - name: Convert yaml to json (publication info) + + - name: Convert yaml to json (publication info) uses: fabasoad/yaml-json-xml-converter-action@v1.0.0 id: yaml2json with: path: '${{ env.PUB_NAME }}.yml' from: 'yaml' to: 'json' + - name: Resolve release tag run: | echo ::set-env name=PUB_TAG::$(echo ${GITHUB_REF/refs\/tags\//}) - - name: Dispatch event to neurolibre.com + + - name: Dispatch event to neurolibre.com uses: peter-evans/repository-dispatch@v1 with: token: ${{ secrets.PAT }} event-type: publish repository: roboneurotest/website-test - client-payload: '{"pub_info": ${{ steps.yaml2json.outputs.data }}, "pub_name": "${{ env.PUB_NAME }}", "pub_tag": "${{ env.PUB_TAG }}"}' - buildJupyterBook: - runs-on: ubuntu-latest - steps: - - name: Chekout repo - uses: actions/checkout@v2 - - name: Build site HTML - run: | - docker pull agahkarakuzu/jbuild - mkdir _site - chmod 777 -R ./_site - docker run --rm --security-opt label:disable \ - -v ${{ github.workspace }}:/srv/jekyll \ - agahkarakuzu/jbuild - rsync -a $GITHUB_WORKSPACE/_site/ $GITHUB_WORKSPACE/ - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.PAT }} - publish_dir: ./ - commit_message: 🤖 Deploy Jupyter Book + client-payload: '{"pub_info": ${{ steps.yaml2json.outputs.data }}, "pub_name": "${{ env.PUB_NAME }}", "pub_tag": "${{ env.PUB_TAG }}"}' \ No newline at end of file diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 0000000..99b648f --- /dev/null +++ b/build-requirements.txt @@ -0,0 +1,3 @@ +-r requirements.txt +jupyter-book +jupytext[myst] diff --git a/editorial/allowed_list.json b/editorial/allowed_list.json new file mode 100644 index 0000000..e30c9a9 --- /dev/null +++ b/editorial/allowed_list.json @@ -0,0 +1,7 @@ +{ + "allowed": [ + "mathieuboudreau", + "TommyBoshkovski", + "emdupre" + ] +} \ No newline at end of file diff --git a/editorial/blacklist.json b/editorial/blacklist.json deleted file mode 100644 index 98c067e..0000000 --- a/editorial/blacklist.json +++ /dev/null @@ -1,5 +0,0 @@ -{ -"blocked": ["mathieuboudreau", - "TommyBoshkovski" -] -} diff --git a/editorial/neurolibre_roles.json b/editorial/neurolibre_roles.json index fb0d543..81dfe2d 100644 --- a/editorial/neurolibre_roles.json +++ b/editorial/neurolibre_roles.json @@ -1,13 +1,13 @@ { "welcome_team": ["mathieuboudreau", - "agahkarakuzu", - "ltetrel", - "pbellec" + "agahkarakuzu", + "ltetrel", + "pbellec" ], "reviewers": [{"handle":"agahkarakuzu","expertise":["qmri","software"],"affiliation":"NeuroPoly Lab, Polytechnique Montreal"}, {"handle":"mathieuboudreau","expertise":["qmri","software"],"affiliation":"Montreal Heart Institute"}, {"handle":"emdupre","expertise":["fmri","software"],"affiliation":"Montreal Neurological Institute, McGill"}, {"handle":"ltetrel","expertise":["software"],"affiliation":"SIMEXP Lab, University of Montreal"}, - {"handle":"pbellec","expertise":["software","neuroimaging"],"affiliation":"SIMEXP Lab, University of Montreal"} - ] + {"handle":"pbellec","expertise":["software","neuroimaging"],"affiliation":"SIMEXP Lab, University of Montreal"} + ] } diff --git a/file-types.json b/file-types.json new file mode 100644 index 0000000..d5cb788 --- /dev/null +++ b/file-types.json @@ -0,0 +1,77 @@ +{ + "Jupyter Notebook": { + "format": ".ipynb", + "icon": "https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/de920fda-40bd-43e8-9ed3-339bb970c3c4/dd8pdzs-cbc64bcd-86d9-4e22-a415-820e63c4e959.png", + "icon_size": 30, + "plural": "s", + "abs_match": false + }, + "Dockerfile": { + "format": "Dockerfile", + "icon": "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/97_Docker_logo_logos-512.png", + "icon_size": 30, + "plural": "s", + "abs_match": false + }, + "JupyterBook config file": { + "format": [ + "_config.yml", + "toc.yml", + "_data/toc.yml" + ], + "icon": "https://jupyterbook.org/_static/logo.png", + "icon_size": 30, + "plural": "s", + "abs_match": true + }, + "Pip Requirements": { + "format": "requirements.txt", + "icon": "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/267_Python_logo-512.png", + "icon_size": 30, + "plural": "", + "abs_match": true + }, + "Other config file": { + "format": [ + "environment.yml", + "Pipfile", + "Pipfile.lock", + "setup.py", + "Project.toml", + "REQUIRE", + "install.R", + "apt.txt", + "DESCRIPTION", + "manifest.yml", + "postBuild", + "start", + "runtime.txt", + "default.nix" + ], + "icon": "https://avatars3.githubusercontent.com/u/13699731?s=280&v=4", + "icon_size": 30, + "plural": "s", + "abs_match": true + }, + "Readme": { + "format": "README.md", + "icon": "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/273_Readme_logo-512.png", + "icon_size": 30, + "plural": "", + "abs_match": true + }, + "License": { + "format": "LICENSE", + "icon": "https://cdn0.iconfinder.com/data/icons/customicondesign-office7-shadow-png/256/License-manager.png", + "icon_size": 30, + "plural": "", + "abs_match": true + }, + "Repo2Data": { + "format": "data_requirement.json", + "icon": "https://cdn4.iconfinder.com/data/icons/cloud-computing-2/500/cloud-arrow-down-512.png", + "icon_size": 30, + "plural": "", + "abs_match": true + } +} \ No newline at end of file diff --git a/integration/google/OAuth.json b/integration/google/OAuth.json index e6928c2..f0b0ab1 100644 --- a/integration/google/OAuth.json +++ b/integration/google/OAuth.json @@ -6,9 +6,9 @@ "runtimeVersion": "V8", "oauthScopes": [ "https://www.googleapis.com/auth/gmail.send", - "https://www.googleapis.com/auth/gmail.compose", + "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.modify", "https://www.googleapis.com/auth/gmail.addons.current.action.compose", "https://www.googleapis.com/auth/script.external_request" - ] + ] } \ No newline at end of file diff --git a/integration/google/onSubmit.gs b/integration/google/onSubmit.gs index d67f4ee..4b0453f 100644 --- a/integration/google/onSubmit.gs +++ b/integration/google/onSubmit.gs @@ -7,58 +7,58 @@ // ------------------------------------------------------------------------- // OAuth SCOPES // ------------------------------------------------------------------------- -// OAuth Scopes required by this script are given in the appscript.json file +// OAuth Scopes required by this script are given in the appscript.json file // located at NeuroLibre's submit repo (neurolibre/submit/.google). // - This file is not visible by default in the project tab. To -// make it visible, View --> Show manifest file. +// make it visible, View --> Show manifest file. // - After you copy the content of NeuroLibre's appscript.json, make sure // that the OAuth scopes are listed in (File-->Project Properties-->Scopes). // ------------------------------------------------------------------------- // TRIGGER // ------------------------------------------------------------------------- // This project's triggger (Edit-->Current Project's trigger) must have the -// following configuration: +// following configuration: // - Function to run: dispatchToNeuroLibre -// - Runs at deployment: Head +// - Runs at deployment: Head // - Event source: From spreadsheet -// - Event type: On form submit +// - Event type: On form submit // ------------------------------------------------------------------------- // API CALLS // ------------------------------------------------------------------------- -// This script uses GitHub REST API (v3 as of May 2020) to: +// This script uses GitHub REST API (v3 as of May 2020) to: // - Open an issue on the target repository on form submission (POST) // - Fetch issue number and lock the conversation (PUT) -// - TODO: Update this header.Script got much bigger. -// Please make sure that the API calls are up to date with the resources -// described by GitHub: https://developer.github.com/. +// - TODO: Why do we lock the conversation? +// Please make sure that the API calls are up to date with the resources +// described by GitHub: https://docs.github.com/. // ------------------------------------------------------------------------- -// VARIABLE NAMING CONVENTIONS +// VARIABLE NAMING CONVENTIONS // ------------------------------------------------------------------------- // To distinguish user-provided global variables from those declared by the script: // -// i - Global variables provided by form submission are stored in formValues +// i - Global variables provided by form submission are stored in formValues // object returned by getFormValues function. All the fieldnames in formValues -// object are CAPITALIZED. +// object are CAPITALIZED. // - var formValues = getFormValues(); -// - formValues.AUTHOR_EMAIL, formValues.AUTHOR_NAME ... etc. -// -// ii - Global variables declared by the script follow camelCase. These variables +// - formValues.AUTHOR_EMAIL, formValues.AUTHOR_NAME ... etc. +// +// ii - Global variables declared by the script follow camelCase. These variables // are intended for easing access to the auxiliary information. List of global -// variable declared by this script are: -// - mapVal, icon*, logo*, header*, footer*, inspectObject, binderConfig +// variable declared by this script are: +// - mapVal, icon*, logo*, header*, footer* // -// iii - Global variables specifying GitHub repository to which authorized +// iii - Global variables specifying GitHub repository to which authorized // API calls will point (e.g. neurolibre/submit) are CAPITALIZED. // - HANDLE, REPO, TOKEN -// -// iv - Local variables follow snake_case. +// +// iv - Local variables follow snake_case. // // ------------------------------------------------------------------------- // FUNCTION NAMING CONVENTIONS // ------------------------------------------------------------------------- -// i- All the function names follow camelCase. +// i- All the function names follow camelCase. // ------------------------------------------------------------------------- -// Author: Agah Karakuzu | 2020 +// Author: Agah Karakuzu | 2020 // agahkarakuzu@gmail.com, Polytechnique Montreal // GitHub: @agahkarakuzu // ------------------------------------------------------------------------- @@ -74,20 +74,21 @@ var HANDLE = "roboneurotest"; var REPO = "submit"; // GitHub Token (of a dev who has write access to the repo) +// This is visible on the script.google.com project var TOKEN = "REDACTED"; // Note that the variable passed to the scope of this project // contains form responses in `.values` field with this mapping between // the column names and the indexes: (A,B,C.. --> 0,1,2...). - + // The following object literal maps the spreadsheet column indexes to // the respective fields. var mapVal = { "author_email": 1, - "author_name": 3, + "author_name": 3, "author_github": 4, - "publication_title": 5, + "publication_title": 5, "publication_type": 6, "article_url": 7, "repo_url":8 @@ -97,68 +98,21 @@ var mapVal = { // ##################################################################### END // --------------------------------------------------------------------- -// Global vars for icons and images +// Global vars for icons and images // ##################################################################### START -var iconBinder = "https://avatars3.githubusercontent.com/u/13699731?s=280&v=4"; -var iconJpbook = "https://sphinx-book-theme.readthedocs.io/en/latest/_static/logo.png"; -var iconPython = "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/267_Python_logo-512.png"; -var iconNotebook = "https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/i/de920fda-40bd-43e8-9ed3-339bb970c3c4/dd8pdzs-cbc64bcd-86d9-4e22-a415-820e63c4e959.png"; var iconGithub = "https://cdn2.iconfinder.com/data/icons/black-white-social-media/64/github_social_media_logo-512.png"; -var iconLicense = "https://cdn0.iconfinder.com/data/icons/customicondesign-office7-shadow-png/256/License-manager.png"; -var iconReadme = "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/273_Readme_logo-512.png"; var iconTwitter = "https://cdn2.iconfinder.com/data/icons/black-white-social-media/32/online_social_media_twitter-512.png"; var iconDev = "https://cdn1.iconfinder.com/data/icons/badges-achievements-001-solid/68/Artboard_8-512.png"; var iconWebsite = "https://cdn3.iconfinder.com/data/icons/black-white-social-media/32/www_logo_social_media-512.png"; -var iconData = "https://cdn4.iconfinder.com/data/icons/cloud-computing-2/500/cloud-arrow-down-512.png"; var logoNeurolibreOutline = "https://github.com/neurolibre/neurolibre.com/blob/master/static/img/favicon.png?raw=true"; var logoNeurolibre = "https://raw.githubusercontent.com/neurolibre/docs.neurolibre.com/master/source/img/logo_neurolibre_old.png"; -var iconDocker = "https://cdn4.iconfinder.com/data/icons/logos-and-brands/512/97_Docker_logo_logos-512.png"; var footerPublication = "https://github.com/roboneurotest/submit/blob/master/images/publication_footer.png?raw=true"; var iconReview = "https://cdn0.iconfinder.com/data/icons/job-seeker/256/conversation_job_seeker_employee_unemployee_work-512.png"; var footerTutorial = "https://github.com/roboneurotest/submit/blob/master/images/tutorial_footer.png?raw=true"; // ##################################################################### END - -// Global vars for repo inspection -// ##################################################################### START - -// TODO: PUT THIS SECTION AS A JSON TO THE BASE OF THE SUBMIT REPO. - -var binderConfig = [ - "environment.yml", - "Pipfile", - "Pipfile.lock", - "setup.py", - "Project.toml", - "REQUIRE", - "install.R", - "apt.txt", - "DESCRIPTION", - "manifest.yml", - "postBuild", - "start", - "runtime.txt", - "default.nix" - ]; - -var inspectObject = { - "files": [ - { "name":"Jupyter Notebook","format":".ipynb","icon":iconNotebook, "icon_size":30,"plural":"s", abs_match:false}, - { "name":"Dockerfile","format":"Dockerfile","icon":iconDocker, "icon_size":30, "plural":"s", abs_match:false}, - { "name":"JupyterBook config file","format":["_config.yml","toc.yml","_data/toc.yml"], "icon":iconJpbook, "icon_size":30, "plural":"s",abs_match:true}, - { "name":"Pip Requirements","format":"requirements.txt", "icon":iconPython, "icon_size":30, "plural":"", abs_match:true}, - { "name":"Other config file","format": binderConfig, "icon":iconBinder, "icon_size":30, "plural":"s", abs_match:true}, - { "name":"Readme","format": "README.md", "icon":iconReadme, "icon_size":30, "plural":"", abs_match:true}, - { "name":"License","format": "LICENSE", "icon":iconLicense, "icon_size":30, "plural":"", abs_match:true}, - { "name":"Repo2Data","format": "data_requirement.json", "icon":iconData, "icon_size":30, "plural":"", abs_match:true}, - ] - -}; -// ##################################################################### END - - // --------------------------------------------------------------------- -// Global vars for HTML template +// Global vars for HTML template // ##################################################################### START var header = "
neurolibre/submit repository to reach out to us.";
- GmailApp.sendEmail(author_email, "Your NeuroLibre submission has failed!","", {htmlBody:getMailBodyFailure(author_github,msg)});
+ if (!response.payload.allowed.includes(author_github) || !response.payload.allowed.includes(owner)){
+ flag = false;
+ msg = "\n Corresponding author and/or the repo owner are not included in the allowed list. " +
+ "If you think that this is an error, we would very much appreciate to hear from you. " +
+ "You can open an issue on neurolibre/submit repository to reach out to us.";
+ GmailApp.sendEmail(author_email,
+ "Your NeuroLibre submission has failed!",
+ "",
+ {htmlBody:getMailBodyFailure(author_github,msg)}
+ );
}else if (response.payload == null){
//Logger.log("I could not read the json file, you should probably kill the operation.");
}
-return {valid: flag, repo_owner: owner, repo_name:name };
+return {valid: flag, repo_owner: owner, repo_name: name };
}
function getMailBodySuccess(formValues,response_object)
{
-
// This functions returns an HTML mail body on a successful submission.
-// Mail content is populated by the information fetched from the spreadsheet.
-
+// Mail content is populated by the information fetched from the spreadsheet.
var html_body=
"" +
- header +
+ header +
"This mail is to confirm that we have successfully received your NeuroLibre submission.
" + "
"+ formValues.PUB_TITLE + "
" + "![]()
We would like to remind you that the reviewing process will happen on
.
![]()
We would like to remind you that the reviewing process will happen on
.
To that end, we have automatically created an issue for your submission in the neurolibre/submit repository.
" + "
Following an automated check, your " + formValues.REPO_OWNER +"/" + formValues.REPO_NAME + " repository will be forked in neurolibre/" + formValues.REPO_NAME + ", if the minimum viable content is available.
" + " Our system will notify you (@" + formValues.AUTHOR_GITHUB + ") through
.
For further information, please visit our reviewing workflow." + - "
Best regards,
" + + "For further information, please visit our reviewing workflow." + + "
Best regards,
" + "" + "" + footer; @@ -600,17 +557,17 @@ return html_body; } function getMailBodyFailure(author_name,errMsg){ -var html_body = +var html_body = "" + - header + + header + "![]()
![]()