GitHub Actions

Continuous Deployment with GitHub Actions

Create Dev Environment Secrets Environment Rules

In this guide, you’ll learn how to set up a development environment in GitHub for use with your GitHub Actions workflows. While we focus on a development namespace, you can follow the same steps to create environments for UAT, SIT, production, or any other stage.

1. Configure the Development Environment

  1. Navigate to your repository’s Settings.
  2. Select Environments in the sidebar.
  3. Click New environment, then enter development as the name.

Once created, you can add protection rules, secrets, and variables.

1.1 Define Deployment Protection Rules

Enforce a 60-second pause before deployments and allow administrators to bypass the delay.

The image shows a GitHub settings page for configuring environment deployment protection rules, including options for required reviewers, wait timers, and environment secrets.

  • Set Wait timer to 60 seconds
  • Enable Allow administrators to bypass this rule
  • Leave branch and tag restrictions at No restrictions
  • Click Save protection rules

Note

You can also require specific reviewers or restrict deployments to certain branches or tags for tighter control.

1.2 Verify the Environment Overview

After saving, confirm that the development environment appears with the configured protection rule.

The image shows a GitHub repository settings page, specifically the "Environments" section, where a "development" environment is configured with protection rules, secrets, and variables.

2. Add Environment Secrets and Variables

GitHub Actions lets you scope secrets and variables to specific environments for improved security and flexibility.

2.1 Add a Kubeconfig Secret

  1. Under the Secrets and variables section of the development environment, click Add secret.
  2. Name it Kubeconfig.
  3. Paste your kubeconfig content and click Save secret.

2.2 Define Environment Variables

Create key/value pairs that your workflows can consume:

The image shows a GitHub repository settings page focused on "Secrets and variables" for actions, displaying environment and repository variables.

VariableValueDescription
NAMESPACEdevelopmentTarget Kubernetes namespace
REPLICAS1Desired number of pod replicas

Warning

Environment-level secrets and variables override any repository-level entries with the same name.

3. Next Steps

In your GitHub Actions workflow, specify:

jobs:
  deploy:
    environment: development
    # … rest of your job

This ensures your deployment respects the environment’s protection rules, secrets, and variables.

References

Watch Video

Watch video content

Previous
Understand Github Environments