No description
Find a file
2023-08-08 23:31:44 +02:00
samples/default chore: remove redundant files 2023-08-07 21:12:54 +02:00
scripts feat: add publish script 2023-08-08 23:16:06 +02:00
src fix: update package manifest to make powershellgallery happy 2023-08-08 23:15:04 +02:00
tests refactor: make this a valid nuget package for Powershell gallery 2023-08-07 20:56:50 +02:00
.gitignore chore: remove redundant files 2023-08-07 21:12:54 +02:00
CHANGELOG.md chore: initialize changelog 2023-08-07 21:15:57 +02:00
LICENSE refactor: make this a valid nuget package for Powershell gallery 2023-08-07 20:56:50 +02:00
PSConfluencePublisher.nuspec fix: update package manifest to make powershellgallery happy 2023-08-08 23:15:04 +02:00
README.md chore: update README 2023-08-08 23:31:44 +02:00
TODO.md docs: add TODO 2023-08-06 04:14:47 +02:00

PSConfluencePublisher

This program is a standalone publisher component for the victorykit-xconfluencebuilder Sphinx extension.

It consumes, a JSON-formatted manifest of a Sphinx build dump generated by the victorykit-xconfluencebuilder and unidirectionally synchronizes pages, page ancestry, and attachments.

Publishing is supported via the Confluence Server REST API through Personal Access Token (PAT) authorization.

(Interchange) Manifest

The manifest consists of a Pages manifest and an Attachments manifest, which store metadata on pages and attachments. Even though the Pages manifests (represented as array object) is expected to have the appropriate order for publishing, where the oldest ancestral generation of pages is published before the youngest, this isn't trusted and the pages manifest is ordered in-place, through a Hoare partitioned Quick-Sort via the Optimize-PagesManifest function.

The manifest is treated as read/write and used for storing additional metadata to reduce the amount of remote data retrieval. This includes hashing of page and attachments content in addition to tracking publishing versions and remote ids. Through a JSONSchema, it is made sure that the manifest stays consistent for interchange with the original manifest producer system (victorykit-xconfluencebuilder).

Usage

You may install this PowerShell module via PowerShellGallery.

PS > Install-Module victorykit.PSConfluencePublisher

Alternatively, you can import the module from source. In order to do that, clone the Git repository , change into the directory and import it.

PS> git clone git@bitbucket.org:victorykit/psconfluencepublisher.git
PS> # universal import statement compatible with PowerShell Core & Desktop
PS> Import-Module "src/PSConfluencePublisher.psd1"

Next, register your personal access token for your Confluence server instance. The token is stored as a SecureString type within the scope of the responsible ested module (PersonalAccessToken). It is expected to have one Personal Access Token per Confluence instance, per PowerShell session.

Register-PersonalAccessToken `
    -Host 'confluence.contoso.com' `
    -Token '123456789123456789'

Optionally, you may test the connectivity to your Confluence instance. The test will try to retrieve your user profile, in order to determine whether the PAT authenticates, since an invalid PAT may results in anonymous authentication, that does not return a fault HTTP status code for some REST API functions.

Test-Connection confluence.contoso.com

Now you may publish by supplying the URL of the root Confluence page you want to publish to, in addition to the location of the local dump manifest. Make sure to use the full URL, with the same hostname as the one you used to register your personal access token.

Publish-Dump `
    -Url 'https://confluence.contoso.com/display/TIARA/Testitest' `
    -DumpIndex build/docs/confluence.out/data.json

The manifest MUST be writable, where it is then used to cache the publishing status of each page and attachment.

You may publish a single page, which however requires it's direct ancestral page to exist.

Publish-Page

Debugging

To display debug messages, set $DebugPreference to Continue, or Inquire in your shell's Global scope.

Static Code Analysis

This program requires PSScriptAnalyzer for static code analysis.

Execute pwsh scripts/analyze.ps1 to do a static code analysis.

Testing

This program requires Pester v5 to execute it's test suite.

Execute pwsh scripts/test.ps1 to run the entire test suite.

Packaging & Publishing

This program does not adhere to Microsoft's Best-Practices of publishing PowerShell modules, in the sense of that it does not use the PowerShellGet module to do so and uses plain nuget CLI instead.

Execute pwsh scripts/pack.ps1 to create a nuget package.

Execute pwsh scripts/publish to publish the nuget package to PowerShellGallery.