CI/CD For Angular using netlify

Hernan Castilla
1 min readNov 4, 2021

--

implementando un ci/cd para angular utilizando GitHub actions y haciendo deploy a netlify

el reto principal son los tests, debido que angular usa karma para ejecutar la parte de pruebas, se deben agregar configuraciones que permitan ejecutar esto sin interfaz gráfica, para esto puedo recomendar 2 soluciones.

  • configurar karma con puppeter
  • cambiar karma por jest (recomendada)

solucionado el tema de los test, solo queda ir a nuestro repositorio y crear dos secrets, netlify_auth_token y netlify_site_id que se obtienen en la configuraron de netlify

prácticamente eso es todo, ahora creamos nuestro archivo .github/workflows/main.yml y listo.

name: ci cd

on:
push:
branches:
- main

jobs:
ci_cd:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- name: install dependencies
run: npm install
- name: tests
run: npm test
- name: build
run: npm run build
- name: deploy
run: |
npm install -g netlify-cli --force
netlify deploy --auth=${{ secrets.netlify_auth_token }} --dir dist/angular-ci-cd --site=${{secrets.netlify_site_id}} --prod

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Hernan Castilla
Hernan Castilla

Written by Hernan Castilla

” Le vent se lève!… Il faut tenter de vivre!”

No responses yet

Write a response