-
🧵 The new GitHub Actions Environments and environment protection rules are live! (for public repositories) Here's a quick and dirty demo on how to add deployments to GitHub Actions. (Test Repo: github.com/stefanzweifel/gh-actions-env-test) ↓
-
Write a deployment workflow, which runs all required checks and your deploy script. In this example, I run the test suite before each deployment. The deployment is done by Laravel Forge. We just curl the deployment URL. github.com/stefanzweifel/gh-actions-env-test/blob/main/.github/workflows/deploy.yml
-
💡 The workflow is triggered by
repository_dispatchorworkflow_dispatchevents, so I can trigger the deployment from outside GitHub (Slack Command, Alfred Workflow, …). (You might update this to listen to thereleaseevent to only deploy when new releases are made.) -
In the repository environment settings, I add people as reviewers for production, so only after manual review stuff goes live.
-
After manually triggering the deployment, I can now approve or reject the deployment request. Staging already went live, as there was no review process defined
-
After successful deployment, I can see the URL to where my app has been deployed. In the repo under "Environments" there's also a neat deployment log.
-
Can't wait till this feature is available to private repositories. 🕺