diff --git a/README.md b/README.md new file mode 100644 index 0000000..8943db7 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# A best-practice Github Actions deployment workflow + +This repository demonstrates using GitHub Actions to deploy into either a `staging` or `production` environment. + +## Setup + +Each deployment environment (i.e., `staging` or `production`) is managed as a [Github Environment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment). 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](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) 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 + +#### 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](https://github.com/alukach/example-github-actions-deployment-workflow/actions/runs/9717940105)): +image + +Otherwise, the deployment will halt when tests fail ([example](https://github.com/alukach/example-github-actions-deployment-workflow/actions/runs/9718017649)): +image