In this workshop, you will implement a CI/CD pipeline to achieve the following tasks:
(on pull requests and pushes to main
)
- Lint the code
- Check the formatting of the code
(only on pushes to main
)
- Build the website distribution
- Upload it to Github Pages
After this has been achieved, you will need to add a new article to the website and create a pull request to add it to the main branch.
- Presentation
- Github Actions general documentation
- Github Actions workflow syntax
- Github Actions workflow contexts
- Github Actions marketplace
- Astro documentation for deploying to Github Pages
npm run setup
: Initial setup of the projectnpm run lint
: Lint the code in the projectnpm run build
: Build the website distributionnpm run format:check
: Check if the code in the project is properly formattednpm run format:write
: Format the code in the project
-
The following actions might be useful:
actions/checkout
: Checkout a repositoryactions/setup-node
: Setup Node.jsactions/upload-pages-artifact
: Upload a GitHub Pages artifactactions/deploy-pages
: Deploy a GitHub Pages artifact to GitHub Pagesactions/cache
: Cache dependencies
Caution
- Don't forget to enable GitHub Pages in your repository settings. Go to Settings > Pages and change Build and Deployment > Source to GitHub Actions.
- Don't forget to change
repositoryName
inastro.config.mjs
to the name of your repository.
In case you get stuck or are just curious, a possible solution is available at limwa/workshop-ci-cd-sinf-2024.
You can also check all Actions executions for that repository here. The resulting pages deployment is available here.