To learn & understand deployment pipelines, what problems they solve, and how they can be integrated at a small scale, using CI/CD tools with Github Actions.
Click here to access Presentation Slides
-
Fork the repository.
- Note: If you have your own Node.js project with several npm/yarn scripts already, you may use that instead.
-
Clone your fork to local. You can run
npm i
andnpm run build
optionally. -
Go to "Actions" tab on your forked repository
-
Look for "Node.js" when searching for a Workflow template
-
You can click "Start Commit" on the right side, or copy the contents of the .yml file and proceed with the following steps:
- Create a folder in the root directory of your fork called
.github
. - Inside the
.github
folder, create a folder calledworkflows
. This is where you will create any workflow files. - Create a
.yml
file, name it whatever you want, and paste the contents you copied from earlier on the remote repository.
- Create a folder in the root directory of your fork called
-
Your
.github/workflows/<name>.yml
file should look very close to this:
name: Node.js CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
- Stage, commit, and push the changes to your remote repository (or the fork) and click on "Actions" on the remote repository again and see the job running live.