Gatsby Static websites CI/CD using Gitlab
Rany ElHousieny, PhD???
Generative AI Engineering Manager | ex-Microsoft | AI Solutions Architect | Expert in LLM, NLP, and AI-Driven Innovation | AI Product Leader
In my previous article "Is serverless system design the future?" (https://www.dhirubhai.net/pulse/serverless-system-design-future-rany-elhousieny/ ) I promised to explain how to deploy my static website (https://rany.tk/) that was created with Gatsby to S3, and I forgot :(. Here I am after few months showing how to auto deploy the site to S3 using Gitlab, which I use for CI/CD. (Code at https://github.com/ranyelhousieny/myResume_GatsBy_Gitlab)
- Create Gitlab project
Add to Gitlab
2. Now from the directory where I have the code for the website I run the following commands:
git init
git remote add origin [email protected]:elhousie/resume-for-rany-elhousieny.git
git add .
git commit -m "Initial commit"
git push -u origin master
3. Now create the pipeline .gitlab-ci.yml as follows
when you push your changes, the pipeline will build automatically
Finally, let's deploy to S3
File can be found at https://github.com/ranyelhousieny/myResume_GatsBy_Gitlab/blob/master/.gitlab-ci.yml