Skip to content

Genez-io/genezio-github-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

genezio-github-action

Validate 'genezio-github-action'

This action sets up a genezio environment for using it in actions.

Usage

To deploy your project on genezio using GitHub Actions, you have to provide a genezio access token.

Follow these steps to setup a genezio access token to use GitHub Actions:

  • Head to the genezio dashboard to generate a genezio access token.
  • Store the access token as a GitHub secret in your repository. To see how to create an action secret check this tutorial.

In the examples below the secret is referred to as secrets.GENEZIO_TOKEN. Change accordingly for your project.

Deployment

An example workflow to deploy the backend of your project with the latest version of genezio:

name: genezio workflow
on:
  push:
    branches:
      - main

jobs:
  deploy-backend:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
      - uses: Genez-io/genezio-github-action@main
        with:
          token: ${{ secrets.GENEZIO_TOKEN }}
      - name: Deploy backend
        working-directory: ./server
        run: genezio deploy

You can test or check logs for the deployed project at https://app.genez.io/projects.

Frontend and backend deployment in different jobs

If you want to deploy the frontend and backend of your project in different jobs, you can use genezio deploy --backend and genezio deploy --frontend commands.

For the frontend deployment, the genezio-generated SDK should be uploaded as an artifact:

  # Use this trick to upload the generated SDK as an artifact
  # It will be used to deploy the frontend
  - uses: actions/upload-artifact@v3
    with:
      name: genezio-generated-sdk
      path: ./client/src/sdk

Documentation

To find more details on how to use genezio, check out the official documentation:

If you cannot find what you are looking for in the docs, don't hesitate to drop us a GitHub issue or start a discussion on Discord.

Troubleshooting

Warnings on npm run build are treated as errors:

The following error may occur when running npm run build to build the frontend source code:

Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.

Failed to compile.

The solution is to set CI to false in package.json or in your workflow:

- name: Deploy backend
  working-directory: ./server
  run: genezio deploy
  env:
    CI: false

License

The associated scripts and documentation in this project are released under the GNU General Public License v3.0 license.