Skip to content

Basic demo of deployment via Github actions.

Notifications You must be signed in to change notification settings

alukach/example-github-actions-deployment-workflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

A best-practice Github Actions deployment workflow

This repository demonstrates using GitHub Actions to deploy into either a staging or production environment.

image

Setup

Each deployment environment (i.e., staging or production) is managed as a Github Environment. Within each Github Environment, we store environment variables and environment secrets to be used during the deployment process. This demonstration repository only uses a single environment variable (MESSAGE) and environment secret (API_KEY).

image

Triggers

Merges to main

When a push occurs to main (e.g. a PR is merged to main or a commit is pushed directly to main), a deployment to the staging environment will be triggered.

Releases

When a new Release occurs, a deployment to the production environment will be triggered.

Manual Deployments

Deployments can be manually triggered from within the Github Actions UI. This allows feature branches to be deployed to an environment outside of the standard git-flow cycle (i.e. first merging to main).

image

Important

Any user with WRITE permissions on the repo can trigger a deployment of any branch to any environment. This can be restricted with by appending a check of the github.actor within the if: clause of the manual deployment job and restricting write access to main (see this discussion for more details).

Forcing Deployments

When manually dispatching a deployment, a user can deploy even if tests fail. image

This will ensure that deployment occurs despite test failures (example): image

Otherwise, the deployment will halt when tests fail (example): image

About

Basic demo of deployment via Github actions.

Resources

Stars

Watchers

Forks

Packages

No packages published