Skip to content

Commit

Permalink
Update build/test instructions in README.
Browse files Browse the repository at this point in the history
There's no advantage to running devdocs inside govuk-docker. It's much
easier and quicker β€” especially for external contributors β€” to run it
directly using Bundler.

Issue #4528 is an example of where the previous (overly complex)
build/run instructions prevented an external contribution.
  • Loading branch information
sengi committed Mar 5, 2024
1 parent 49a0ead commit 08f8768
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,73 @@
# GOV.UK Developer Docs

πŸ‘‰ https://docs.publishing.service.gov.uk
πŸ‘‰ https://docs.publishing.service.gov.uk/

This is a static site generated with Middleman, using [alphagov/tech-docs-template](https://github.com/alphagov/tech-docs-template).

Some of the files (like the CSS, javascripts and layouts) are managed in the template and are not supposed to be modified here. Any project-specific
Ruby code needs to go into `/app`.

## Technical documentation
## Build the app locally

You can use the [GOV.UK Docker environment](https://github.com/alphagov/govuk-docker) to run the application and its tests with all the necessary dependencies. Follow [the usage instructions](https://github.com/alphagov/govuk-docker#usage) to get started.

**Use GOV.UK Docker to run any commands that follow.**
```sh
bundle install
```

### Running the app
## Run the tests locally

```
./startup.sh
bundle exec rake
```

The docs include pages pulled from other GitHub repositories. By default, all these "proxy" pages are pulled when you start the app, which can lead to rate limit error. Using a GitHub API token avoids this.
## Run the app locally

[Create a GitHub auth token](https://github.com/settings/tokens/new) (the token doesn't need any permissions).
```sh
SKIP_PROXY_PAGES=true ./startup.sh
```

Store the token in a `.env` file like this:
## Proxy pages

```
GITHUB_TOKEN=somethingsomething
```
The live docs site includes pages from other alphagov GitHub repositories. To test this locally, omit `SKIP_PROXY_PAGES=true` from the command above.

Alternatively, you can also disable proxy pages temporarily e.g.
The app downloads these "proxy pages" at startup and this can cause GitHub to rate limit your requests. You can pass a valid GitHub API token to the app to help avoid this:

```
env SKIP_PROXY_PAGES=true ./startup.sh
```
1. [Create a GitHub token](https://github.com/settings/tokens/new). The token doesn't need any scopes.

Disabling proxy pages means you'll get a "Not Found" error if you try to access them locally.
1. Store the token in a `.env` file:

### Testing the app
```sh
GITHUB_TOKEN=somethingsomething
```

```
bundle exec rake
```
1. Start the application:

### Updating the template
```sh
./startup.sh
```

You can pull down the latest version of the Tech Docs template by running:
## Update to the latest Tech Docs template

```sh
bin/update
```

### Deployment
## Deployment

We host GOV.UK Developer Docs as a static site on GitHub Pages. The [ci.yml] GitHub Actions workflow updates the site automatically:

This project is hosted on GitHub Pages. It is [redeployed hourly on weekdays][actions]
(to pick up changes to external docs) and whenever a PR is merged.
- when a PR is merged to the default branch
- on an hourly schedule, to pick up changes to docs included from other repos

As part of the deployment, we build a static set of pages to minimise the response time
and potential issues with remote API calls.
### Build the static site locally

```sh
NO_CONTRACTS=true bundle exec middleman build
```

This will create a bunch of static files in `/build`.
This will create a `build` directory containing a set of HTML files.

## Licence

[MIT License](LICENCE)

[actions]: https://github.com/alphagov/govuk-developer-docs/blob/main/.github/workflows/ci.yml
[ci.yml]: /.github/workflows/ci.yml

0 comments on commit 08f8768

Please sign in to comment.