I chose to use Gatsby to build my website with as it is cutting edge and very responsive.
After laying out a basic build in local development, I commited changes to the GitHub repository and set up automatic deployment to Netlify when any updates are pushed to the remote main branch. However, this meant that every time I commited changes, the build would run automatically in Netlify.
To have more control over this, rather than committing changes directly to main I implemented focused features through the system of raising issues, working on them as branches, submitting a pull request and then merging them in a proper pipeline.
I automated the GitHub projects Kanban board to track these changes and integrated it with my personal Slack channel so I could add and track issues dynamically.
The project board please do raise an issue to make any suggestions or improvements for my site!
Slack integration
I then added in a GitHub Actions workflow to automatically build and test any changes pushed to the dev branch or when a pull request was submitted to main branch before they are deployed.
GitHub Actions workflow file
I integrated Contentful CMS for easy managing of content and content models, so that I can update the articles on the page easily. I also created a separate environments in Contentful to test content changes in staging environment first before they are commited to master branch used for production build in deployment:
The staging environment API Keys were placed in an '.env.development' file and configured to run with gatsby develop. The master environment Keys were placed in an '.env.production' file for use during gatsby build / deployment.
These keys also had to be referenced as environment variables in GitHub in order to pull through into the build process in the GitHub actions workflow.
Using the contentful-cli
content management api to push updates from staging environment to master environment in Contentful.
First we export the changes we want to update from the staging environment into a json file:
contentful space export --space-id {space-id} --environment-id develop -- query-entries 'content_type={content-model}'
If both environments have the same Content-Type we can use --content-only
.
Then we import the changes from that file to the master environment:
contentful space import --space-id {space-id} --environment-id qa --content-file {file}
Alternatively, we can write a json config file to select the settings we want rather than using --flags
in the command line:
contentful space export --config config-export.json
contentful space import --config config-import.json
For basic layout of pages and global styles I chose css modules.
For components I chose the styled-components
module for better functionality.
For anything colour related I provided a theme through theme-ui to create a theme switching button and consistent colour and formatting across the site.
I plan to integrate automated testing with Cypress in future and incorporate this as a job in the GitHub actions workflow.