For publishing ReSpec documents on the Geonovum website https://docs.geostandaarden.nl a few ReSpec utilities have been created:
- automatically publish the document after a GitHub release has been made (using a webhook), see directory
src/autodeploy/
- creating an index page of published documents, see
src/www/index.php
Originated from github issue Geonovum/respec#148, this PHP script automatically publishes the ReSpec documents if a release is made on GitHub and updates the last version of the ReSpec document on https://docs.geostandaarden.nl. To use this method of publishing, the ReSpec document and the Github repo of the document have to meet some requirements. If these are not met, manual publication is the only option.
- a webserver that runs PHP (for Geonovum on https://docs.geostandaarden.nl), where the script
releasecreated.php
andutils.php
are placed - a writable directory for the PHP script to create directories and documents in (for Geonovum on https://docs.geostandaarden.nl)
- a config file for github named
githubConfig.php
in the same directory asreleasecreated.php
, that contains:- the Github webhook secret (ask the github maintainers for this secret when setting it up)
- the full URL to the file pubDomainList.json (see below)
- a web accessible list of publication domain (directories) per ReSpec document (pubDomainList.json in this repository). This document could be in this GitHub repo for example.
- this list is important to make sure that existing other ReSpec documents are not (accidentally) overwritten.
- a publication domain is used as directory on the webserver
- the shortName of the ReSpec doc, to update the latest version copy
- an optional title for the pubDomain, for the index at https://docs.geostandaarden.nl
Example pubDomainList.json
, for 2 different github accounts, with several github repositories:
{
"Geonovum": [{
"repoName": "NEN3610-Linkeddata",
"pubDomain": "nen3610",
"pubDomainTitle": "NEN3610-Linkeddata",
"shortName": "nldp"
},{
"repoName": "whitepaper-standaarden",
"pubDomain": "wp",
"pubDomainTitle": "Whitepaper Geostandaarden",
"shortName": "wpgs"
}],
"thijsbrentjens": [{
"repoName": "wfs-storedqueries",
"pubDomain": "wfs",
"shortName": "wfs-sq"
}]
}
Example githubConfig.php
file:
<?php
// the full URL to the json file with the pubDomains per github repo
$pubDomainListURL = 'https://raw.githubusercontent.com/Geonovum/respec-utils/master/src/autodeploy/config/pubDomainList.json';
// configure the secret in GitHub's webhook
$hubSecret = 'My secret';
?>
For a ReSpec document to be published, the following requirements have to be met.
For the Github repository:
- make sure the ReSpec document has it's own, exclusive GitHub repository and the document is in the root directory of the repository
- all media files (e.g. images) shall be placed in the directory
./media/
in the repository. This is the only directory that will be copied the publication server
- all media files (e.g. images) shall be placed in the directory
- a webhook to the proper PHP page is created in the GitHub repository, for events of type
release
. Go to the Settings of the repository, then choose Webhooks in the left-side menu and add a webhook:- set the Payload URL to the full URL of the
releasecreated.php
script (ask the Geonovum ReSpec maintainers for this URL when setting up the webhook) - content type
application\x-www-form-urlencoded
- make sure that the secret is set correctly (ask the Geonovum ReSpec maintainers for this secret when setting up the webhook)
- set the events that trigger the webhook:
- choose "Let me select individual events", then
- set individual events to: Releases (others won't be processed)
- set the Payload URL to the full URL of the
Configure the domain and document shortname:
- make sure there is an entry in
pubDomainList.json
for the publication domain and the shortname of the document. Ask the Geonovum ReSpec maintainers to create this.
- the document to publish on https://docs.geostandaarden.nl shall be a snapshot of the ReSpec document named
snapshot.html
in the root directory of the repo- again: only images or other resources in the
./media/
-directory will be copied
- again: only images or other resources in the
- create a new release (via Github's website)
- make sure that the tagname of the release is identical to the last part of the "This version" URL. E.g.
cv-im-imvg-20180718
. Format:{status}-{type}-{shortName}-{date}