# CI/CD with GitHub

One of the advantages of working with Widgets locally using the Modyo CLI(modyo-cli) is that you can use tools to automate code review (CI) and perform continuous delivery or continuous deployment (CD).

Our Widgets catalog, as well as base templates to start a new project, provide "recipes" from GitHub Actions (opens new window) that you can use to run some of the most common CI/CD tasks quickly and easily.

These _"recipes" _ are in the README.md file located in the Widget's .github folder.

├── .Github/
│ ├── pr-labeler.yml
│ ├── release-drafter.yml
│ ── workflows/
│ ├── README.md <- * recetas * -> 
│ ├── pr-labeler.yml
│ ── release-draft.yml
├── src/
│ ├── App.vue

The recipes you can find are:

  • Build and publish to Modyo
  • Run ESLint, Stylelint, and Unit Tests on pull requests
  • Publish package on GitHub registry
  • Release draft
  • Release draft config
  • PR Labeler
  • PR Labeler config

Tip

Each of these is documented and explained in the README.md file

# Deploying a Widget with GitHub Actions

In order to load a Widget using GitHub Actions we need the "recipe" Build and Publish that makes use of the command PUSH of Modyo CLI and for that we need a token that authorizes it.

To get a token we first need to create an API Access at the site's account level. Navigate to **Settings (1) —> API access (2) —> New API access (3) —> + New API Access (4) **.

Image displaying where to find the API Access button in Modyo Platform

After creating the access API we need to generate a token for the user who will load the Widget.

Tip

We recommend creating a new user that has permissions and the token to upload and publish Widgets from a CI/CD service.

Once again at account level:

  1. Settings
  2. Team (we select or create a user)
  3. API access tab
  4. Select the Api access we created earlier
    • New Access Token
Image displaying where to find the Generate Access Token button in Modyo Platform

We now have the token we can use to configure our repository and so the GitHub action will have access to it.

Image displaying your new API Access Token in Modyo Platform

Danger

You should never share or publish the TOKEN or sensitive information in the repository! It is recommended to use environment variables, an .env file that is listed in the project's .gitignore locally, and make use of the secrets (opens new window) on GitHub.

Last Updated: 8/2/2022,