Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global antora file #386

Merged
merged 54 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
a628b9d
latest supported platform
fantkolja Sep 2, 2024
fbbca51
include version branches
fantkolja Sep 2, 2024
ddbf816
include version branches
fantkolja Sep 2, 2024
0e16ef5
include version branches
fantkolja Sep 2, 2024
e68fc68
include version branches
fantkolja Sep 2, 2024
72d8482
correct 5.5. version MC
fantkolja Sep 2, 2024
40ddbe9
correct 5.5. version MC
fantkolja Sep 2, 2024
b46319d
Merge branch 'hazelcast:main' into main
fantkolja Sep 2, 2024
aba5cb0
Merge branch 'hazelcast:main' into main
fantkolja Sep 4, 2024
b935a50
Merge branch 'hazelcast:main' into main
fantkolja Sep 10, 2024
603c385
Merge branch 'hazelcast:main' into main
fantkolja Oct 16, 2024
872a006
add tg bot
fantkolja Oct 16, 2024
af8e3b4
Merge branch 'main' into feature/global-antora-file
fantkolja Oct 16, 2024
5cf206d
global check-links
fantkolja Oct 16, 2024
cc0381c
global check-links
fantkolja Oct 16, 2024
81f921c
global check-links
fantkolja Oct 16, 2024
345e7d3
global check-links
fantkolja Oct 16, 2024
e24c9f7
global check-links
fantkolja Oct 16, 2024
fad37e2
add check-links script
fantkolja Oct 22, 2024
daa7290
add check-links script
fantkolja Oct 22, 2024
7333de6
Merge branch 'main' into feature/global-antora-file
fantkolja Oct 22, 2024
0825b5a
add check-links script
fantkolja Oct 22, 2024
f1c8a85
Merge branch 'feature/global-antora-file' of github.com:fantkolja/man…
fantkolja Oct 22, 2024
1bc7426
add decline allow btns
fantkolja Oct 23, 2024
fd89213
add check-links script
fantkolja Oct 29, 2024
6c4c950
add check-links script
fantkolja Oct 29, 2024
c4c5dac
refactor
fantkolja Nov 13, 2024
5131589
refactor
fantkolja Nov 13, 2024
3783e5d
refactor
fantkolja Nov 13, 2024
53ef7b5
refactor
fantkolja Nov 13, 2024
3fb1949
refactor
fantkolja Nov 13, 2024
c89e05e
refactor
fantkolja Nov 14, 2024
68753f3
refactor
fantkolja Nov 14, 2024
b3bf74b
refactor
fantkolja Nov 14, 2024
213cf73
refactor
fantkolja Nov 14, 2024
0e4097f
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
eaa101d
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
8d3abf5
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
f493ec9
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
a9cb2d5
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
afe9b17
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
a13c98a
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
65e8f39
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
febdeb1
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
d590e4e
add reusable parts for global check-links across docs repos
fantkolja Nov 14, 2024
9414a5e
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
8e2aa83
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
c9e97f5
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
ddd09f4
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
edfe18b
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
08188bc
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
ab9fb67
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
2cb5938
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
d3dca0e
add reusable parts for global check-links across docs repos
fantkolja Nov 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,18 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 16

- name: Checkout global antora-playbook
uses: actions/checkout@v4
with:
repository: hazelcast/hazelcast-docs
sparse-checkout: antora-playbook.yml
sparse-checkout-cone-mode: false
path: hazelcast-docs
ref: main
JackPGreen marked this conversation as resolved.
Show resolved Hide resolved

- name: Check for broken internal links
run: |
npm i
npm run-script fetch-check-links-playbook -- $GITHUB_REPOSITORY $GITHUB_BASE_REF
npm run-script check-links-local
168 changes: 0 additions & 168 deletions check-links-playbook.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also delete the definition from package.json?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script load-check-links-playbook.js creates that check-links-playbook.yml but on the fly.

But I also don't like that check-links-local references a non-existing file, so I will probably refactor this part in the further work...

This file was deleted.

48 changes: 48 additions & 0 deletions load-check-links-playbook.js
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the plan is to share this with other repos, can we centralise it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some summary documentation would help on what this does at a high-level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do both: centralizing and docs after we approve that the whole idea is worth implementing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some summary documentation would help on what this does at a high-level.

Will do both: centralizing and docs after we approve that the whole idea is worth implementing

That was a polite way of me saying, I don't think I fully understand what this does

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const YAML = require('yaml');
const fs = require('fs');

const [currentRepoName, baseBranchName] = process.argv.slice(-2);

if (currentRepoName.endsWith('.js') || baseBranchName.endsWith('.js')) {
throw new Error('GitHub repository name and base branch should be passed as arguments');
}

console.log('Repository name: ', currentRepoName);
console.log('Base branch: ', baseBranchName);

// 1. Load and parse local antora-playbook.yml
const localAntoraPlaybookContent = fs.readFileSync('./antora-playbook.yml', 'utf8');
const localAntoraPlaybook = YAML.parse(localAntoraPlaybookContent);

// 2. Load and parse global antora-playbook.yml's content.sources
const globalAntoraPlaybookContent = fs.readFileSync('./hazelcast-docs/antora-playbook.yml', 'utf8');
const globalAntoraPlaybook = YAML.parse(globalAntoraPlaybookContent);
let globalSources = globalAntoraPlaybook.content.sources;
// 3. Modify global content.sources
// - add hazelcast-docs GitHub URL
const hazelcastDocsSource = globalSources.find(source => source.url === '.');
hazelcastDocsSource.url = 'https://github.com/hazelcast/hazelcast-docs';

// - remove Swagger docs
globalSources = globalSources.filter(source =>
!(source.url === 'https://github.com/hazelcast/hazelcast-mono')
&& !(source.url === 'https://github.com/hazelcast/management-center'));

// - add current branch
globalSources.unshift({
url: '.',
branches: 'HEAD',
start_path: 'docs',
});

// - remove current branch from the
const currentRepoSource = globalSources.find(source => source.url.endsWith(currentRepoName));
currentRepoSource.branches.push(`!${baseBranchName}`);

localAntoraPlaybook.content.sources = globalSources;
// 4. Replace local content.sources with the modified content.sources
fs.writeFileSync(
'./check-links-playbook.yml',
YAML.stringify(localAntoraPlaybook),
{ encoding: 'utf8' },
);
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
"scripts": {
"build": "antora --to-dir docs --fetch antora-playbook.yml",
"build-local": "antora --to-dir test --fetch antora-playbook-local.yml",
"fetch-check-links-playbook": "node load-check-links-playbook.js",
"check-links-local": "antora --fetch --to-dir test --log-level=error --log-failure-level=error --extension=@jcahills/antora-link-checker check-links-playbook.yml",
"serve": "serve test",
"expose": "ngrok http 5000"
},
"devDependencies": {
"@antora/cli": "^3.1.1",
"@antora/site-generator": "^3.1.1",
"@jcahills/antora-link-checker": "^1.0.1",
"@djencks/antora-aggregate-collector": "^0.1.0-beta.1",
"@jcahills/antora-link-checker": "^1.0.1",
JackPGreen marked this conversation as resolved.
Show resolved Hide resolved
"asciidoctor-kroki": "^0.10.0",
"ngrok": "^4.2.2",
"serve": "^13.0.2"
"serve": "^13.0.2",
"yaml": "^2.6.0"
}
}
Loading