Skip to content

Commit

Permalink
Merge pull request #123 from nuxeo/master-nx-assets
Browse files Browse the repository at this point in the history
Master nx assets
  • Loading branch information
woodyrew authored Mar 18, 2024
2 parents 340a5b4 + 643519f commit b024053
Show file tree
Hide file tree
Showing 9 changed files with 2,610 additions and 282 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
77 changes: 77 additions & 0 deletions .github/workflows/doc.nuxeo.com.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Build and Deploy doc.nuxeo.com

on:
push:
branches:
- master
- development
- master-nx-assets

jobs:
documentation_ci:
name: Build & Publish documentation to ${{ github.ref_name == 'master' && 'production' || 'development' }}
runs-on: doc
environment:
name: ${{ github.ref_name == 'master' && 'production' || 'development' }}
steps:

- name: Configure SSH client
run: |
echo "$SSH_CONFIG" >> $HOME/.ssh/config
env:
SSH_CONFIG: "${{ secrets.SSH_CONFIG }}"

- name: Set up SSH
uses: webfactory/ssh-agent@d4b9b8ff72958532804b70bbe600ad43b36d5f2e # v0.8.0
with:
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '14'

- name: Check Versions and Save to File
run: |
echo "git $(git --version)" > runtime-versions.txt
echo "node version $(node --version)" >> runtime-versions.txt
echo "npm version $(npm --version)" >> runtime-versions.txt
echo "IP $(curl -s ipinfo.io/ip)" >> runtime-versions.txt
- name: Install dependencies
run: npm ci --registry="https://registry.npmjs.org" || npm install --registry="https://registry.npmjs.org"

- name: Build
env:
ALGOLIA_KEY: ${{ secrets.NX_TOKEN }}
DEBUG_FILE_LEVEL: debug
run: npm start

- name: Generate Nginx Redirects
run: |
bin/redirects-yml2nginx > redirects.txt
echo > redirects_pageid.txt
- name: Deploy to Server
run: |
rsync -Wxvurk --delete site/ "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/"
rsync redirects.txt "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt"
rsync redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt
- name: Nginx Config Test and Restart
run: |
ssh "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}" \
"service nginx configtest && service nginx restart"
- name: Archive Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
redirects_pageid.*
redirects.*
*.txt
npm-debug.log
40 changes: 19 additions & 21 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ default:
- '**.DS_Store'
- '*~'
- '*.swp'
nx_assets_url: https://intranet.nuxeo.com/nuxeo
# nx_assets_url: http://intranet-preprod.nuxeocloud.com/nuxeo
canonical_version_preference: 'LTS 2019'
new_version: '10.10'

Expand Down Expand Up @@ -67,28 +65,28 @@ default:
platform:
url: [email protected]:nuxeo/doc.nuxeo.com-content.git
branches:
static:
'static-nx-assets':
no_versioning: true
design:
no_versioning: true
'2023':
'2023-nx-assets':
label: 'LTS 2023'
order: 10
'2021':
'2021-nx-assets':
label: 'LTS 2021'
order: 20
url_path: '2021'
'1010':
'1010-nx-assets':
label: 'LTS 2019'
noindex: true
order: 30
url_path: '1010'
'910':
'910-nx-assets':
label: 'LTS 2017'
noindex: true
order: 40
url_path: '910'
'810':
'810-nx-assets':
label: 'LTS 2016'
noindex: true
order: 50
Expand All @@ -101,68 +99,68 @@ default:
label: 'none'
noindex: true
url_path: '60'
master:
'master-nx-assets':
label: 'none'
noindex: true
url_path: 'master'
java:
url: [email protected]:nuxeo/doc.nuxeo.com-client-java.git
branches:
'3.13':
'3.13-nx-assets':
label: '3.13'
url_path: '3.13'
order: 0
'3.12':
'3.12-nx-assets':
label: '3.12'
url_path: '3.12'
noindex: true
order: 10
'3.11':
'3.11-nx-assets':
label: '3.11'
url_path: '3.11'
noindex: true
order: 20
'3.10':
'3.10-nx-assets':
label: '3.10'
url_path: '3.10'
noindex: true
order: 30
'3.9':
'3.9-nx-assets':
label: '3.9'
url_path: '3.9'
noindex: true
order: 40
'3.8':
'3.8-nx-assets':
label: '3.8'
url_path: '3.8'
noindex: true
order: 50
'3.7':
'3.7-nx-assets':
label: '3.7'
url_path: '3.7'
noindex: true
order: 60
'3.6':
'3.6-nx-assets':
label: '3.6'
url_path: '3.6'
noindex: true
order: 70
'3.5':
'3.5-nx-assets':
label: '3.5'
url_path: '3.5'
noindex: true
order: 80
'3.4':
'3.4-nx-assets':
label: '3.4'
url_path: '3.4'
noindex: true
order: 90
'3.3':
'3.3-nx-assets':
label: '3.3'
url_path: '3.3'
noindex: true
order: 100
'3.2':
'3.2-nx-assets':
label: '3.2'
url_path: '3.2'
noindex: true
Expand Down
48 changes: 19 additions & 29 deletions docs/writing-documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,12 @@ cd doc.nuxeo.com-content

#### Run Locally

You will need your Nuxeo Intranet credentials for the screenshots to display correctly.

```bash
NX_ASSETS_USER='{username}' NX_ASSETS_PWD='{password}' npm run dev
npm run dev
```

Make sure to replace `{username}` and `{password}` with your credentials.

Once started, http://localhost:3000 opens automatically. Browse to the URL you want to see your changes.

If the screenshots aren't a concern, you can run locally without the `NX_ASSETS_...` credentials:

```bash
npm run dev
```

If you want to skip the initial build and use the existing one as the base, you can do:

```bash
Expand Down Expand Up @@ -106,15 +96,15 @@ See [main project trouble shooting](https://github.com/nuxeo/doc.nuxeo.com/blob/

# Create a Page

**FROM GITHUB UI**
**FROM GITHUB UI**

You can create a new page from GitHub UI:
You can create a new page from GitHub UI:

1. Go to the folder on GitHub where you want your page to be created (for example if you want to add a new page under [Web UI](https://doc.nuxeo.com/nxdoc/web-ui), the new page will have to be created [here](https://github.com/nuxeo/doc.nuxeo.com-content/tree/master/src/nxdoc/web-ui)).
1. Go to the folder on GitHub where you want your page to be created (for example if you want to add a new page under [Web UI](https://doc.nuxeo.com/nxdoc/web-ui), the new page will have to be created [here](https://github.com/nuxeo/doc.nuxeo.com-content/tree/master/src/nxdoc/web-ui)).

2. Click on **Create new file** at the top of the table
2. Click on **Create new file** at the top of the table

3. A blank page is displayed, copy paste the content in the [new-page-template.md](new-page-template.md).
3. A blank page is displayed, copy paste the content in the [new-page-template.md](new-page-template.md).

4. Make sure to give your page a title and to name your file `.md`

Expand Down Expand Up @@ -328,7 +318,7 @@ These require us to use the reference style of links:

### To Images

Most of the screenshots are stored in the Intranet under [this folder](https://intranet.nuxeo.com/nuxeo/ui/#!/doc/4af58911-f0b1-4a79-a517-4fdde449478e).
Most of the screenshots are stored in the Intranet under [this folder](https://intranet.nuxeo.com/nuxeo/ui/#!/doc/4af58911-f0b1-4a79-a517-4fdde449478e).

**Add a New Screenshot**

Expand All @@ -342,18 +332,18 @@ Most of the screenshots are stored in the Intranet under [this folder](https://i
2. Go to the existing folder named after the title of the documentation page concerned.
3. Click on **Create** > **DOCASSET**.
4. Fill in the metadata related to your screenshot and click on Create.</br>
Your screenshot document is created.
Your screenshot document is created.
5. You will see an Asset markdown snippet section under the preview of your screenshot with a generated unique ID.
6. Make sure to select **Use border** and **Override size** to adjust the size of your screenshot.</br>
Generally, an icon is 20px, a pop-up 350px and a screenshot is 650px (that's the max size for a screenshot).
7. Click on the copy icon next to the snippet section and paste it on the documentation page.
6. Make sure to select **Use border** and **Override size** to adjust the size of your screenshot.</br>
Generally, an icon is 20px, a pop-up 350px and a screenshot is 650px (that's the max size for a screenshot).
7. Click on the copy icon next to the snippet section and paste it on the documentation page.

**Update an Existing Screenshot**

1. Go to the existing folder named after the title of the documentation page concerned
2. Find the screenshot that you want to replace
3. Click on the **Replace** icon under the preview of the screenshot.
4. The screenshot ID won't change so once the doc build will be redeployed it will fetch the updated screenshot.
3. Click on the **Replace** icon under the preview of the screenshot.
4. The screenshot ID won't change so once the doc build will be redeployed it will fetch the updated screenshot.

<!--
Link to images should be written like this:
Expand All @@ -373,7 +363,7 @@ All options with file from another space and page:
```
![Alt text - Required]({{file space='nxdoc' page='client-sdks' name='your_img.png'}} ?w=180,h=360,border=true,thumbnail=true,align=right "Title text - Optional")
```
-->
-->
<!--
#### Image options
Expand Down Expand Up @@ -553,17 +543,17 @@ For instance:
# Edit a Page

To edit a page, you can directly click on the **Edit** button displayed under the title of every page, it will lead you to the correct page to edit on GitHub.
To edit a page, you can directly click on the **Edit** button displayed under the title of every page, it will lead you to the correct page to edit on GitHub.
1. Click on the **Edit** button.</br>
The page is displayed on GitHub.
2. Click once again on **Edit**. </br>
The page turns into Edition mode.
3. Add your modification (fix a typo, fix a link, add a new paragraph/section, etc.
The page turns into Edition mode.
3. Add your modification (fix a typo, fix a link, add a new paragraph/section, etc.
4. You can check on the **Preview Changes** tab how your changes look like.
5. Once you're ready, go to the bottom of the page, the option **Create a new branch for this commit and start a pull request.** is selected by default, click on **Propose file change**. </br>
The pull request screen is displayed.
The pull request screen is displayed.
6. Click on **Create pull request**. </br>
You're done! The pull request will be reviewed and merged by the documentation team.
You're done! The pull request will be reviewed and merged by the documentation team.

## Review a Page

Expand Down
3 changes: 0 additions & 3 deletions lib/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const sitemap = require('metalsmith-sitemap');
// metalsmith local packages
const algolia_prep = require('../modules/metalsmith/algolia_prep');
const css_md5 = require('../modules/metalsmith/css_md5');
const doc_assets = require('../modules/metalsmith/doc_assets');
const file_contents_preprocess = require('../modules/metalsmith/file_contents_preprocess');
const filter = require('../modules/metalsmith/filter');
const fix_handlebars = require('../modules/metalsmith/fix_handlebars');
Expand Down Expand Up @@ -341,8 +340,6 @@ const build = (source_path, metadata, destination_path, repo_details) => {
)
)
.use(time('layouts'))
.use(doc_assets())
.use(time('doc_assets'))
.use(
permalinks({
relative: false,
Expand Down
Loading

0 comments on commit b024053

Please sign in to comment.