Skip to content

Instantly share code, notes, and snippets.

@digitalronin
Last active January 21, 2021 07:45
Show Gist options
  • Save digitalronin/95376856ffa9e32d5cfa8bbc32fa799e to your computer and use it in GitHub Desktop.
Save digitalronin/95376856ffa9e32d5cfa8bbc32fa799e to your computer and use it in GitHub Desktop.
Script to update MoJ documentation sites created using ministryofjustice/template-documentation-site
#!/bin/sh
TEMPLATE_REPO=https://raw.githubusercontent.com/ministryofjustice/template-documentation-site/main
MAKEFILE=${TEMPLATE_REPO}/makefile
PUBLISH_ACTION=.github/workflows/publish.yml
CHECK_ACTION=.github/workflows/check-links.yml
PUBLISH_YML=${TEMPLATE_REPO}/${PUBLISH_ACTION}
CHECK_YML=${TEMPLATE_REPO}/${CHECK_ACTION}
# Remove local files which are now provided by the publishing docker image
echo "Removing files which are no longer needed."
rm -f Gemfile Gemfile.lock config.rb
# Replace the makefile
echo "Updating makefile"
curl -s ${MAKEFILE} > makefile
# Replace the github actions
echo "Updating ${PUBLISH_ACTION}"
curl -s ${PUBLISH_YML} > ${PUBLISH_ACTION}
echo "Adding ${CHECK_ACTION}"
curl -s ${CHECK_YML} > ${CHECK_ACTION}
echo
echo Update complete.
echo
echo Please check the changes, then "git add" and "git push"
echo
@digitalronin
Copy link
Author

This script can be used by documentation sites created before 2021-01-18 from the MoJ Documentation Repository.

It updates your site to take advantage of some recent changes which avoid the problem of unnecessary dependabot alerts which break the publishing process if you merge them.

This change uses a new publisher image (built from this repo) which has the necessary files baked in, along with publishing and previewing scripts which put the files in place at build/preview time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment