Build and deploy with GitHub Actions ΒΆ

This how-to guide shows you how to build and deploy your application using GitHub Actions and the Nais CLI.

Prerequisites ΒΆ

Authorize your Github repository for deployment ΒΆ

  1. Open Nais Console in your browser and select your team.
  2. Select the Repositories tab
  3. Input your repository (organization/repository) and press Add.

Create a Github workflow ΒΆ

.github/workflows/main.yaml
yaml
1
GitHub actions should be pinned to a SHA for better security. Read more in GitHub Secure use reference.
2
Environment is the Nais environment to deploy to. You can find available values in workloads/environments.

This example workflow is a minimal example that builds, signs, and pushes your container image to the image registry. It then deploys the app.yaml using the Nais CLI.

The freshly built image is passed to the deploy step with --set spec.image=<image>, which overrides the spec.image field in the manifest. For how Nais resolves the image, see Applying a manifest.

When this file is pushed to the main branch, the workflow will be triggered, and you are all set.

What's next ΒΆ

This guide deploys to a single environment. To deploy to several environments and split manifest changes from code changes, see Set up a complete deploy pipeline.