Kurocado Studio Styleguide Help

Deploy Workflow

Prerequisites

Overview

Automates the deployment process, including deploying to staging and production environments based on branch merges. The Deploy workflow listens for pull request merges into the dev and main branches and triggers deployments accordingly.

The following sequence diagram illustrates the interactions and steps involved in the Deploy workflow, triggered by the merging of a pull request into the dev or main branch.

DeveloperGitHub RepositoryGitHub Actions RunnerReusable Deploy WorkflowFly.ioSentryalt[Merged into `dev`][Merged into `main`]Merge PR into `dev` or `main` BranchTrigger Deploy WorkflowInvoke Reusable Deploy WorkflowCheckout RepositoryInstall DependenciesBuild ProjectDeploy to StagingDeploy to ProductionIntegrate Deployment with SentryConfirmation of DeploymentConfirmation of IntegrationDeployment SuccessfulDeveloperGitHub RepositoryGitHub Actions RunnerReusable Deploy WorkflowFly.ioSentry

Step 1 — Create an app with Fly Launch

Start by reading create an app with Fly Launch

Step 2 — Create the Deployment Workflow File

Create a GitHub Actions workflow file that defines the automated steps for deploying your project to staging and production environments

a. Add the Workflow File

  1. In your repository, navigate to the .github/workflows/ directory. If it doesn't exist, create it.

  2. Create a new file named deployment.yml (or any name of your choice).

b. Define the Workflow

Add the following content to the deployment.yml file:

name: Deploy on PR Merge on: pull_request: types: [closed] branches: - main - dev jobs: deploy: name: Deploy if: github.event.pull_request.merged == true uses: kurocado-studio/styleguide/.github/actions/deploy@main with: commit_sha: ${{ github.event.pull_request.merge_commit_sha }} env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
Last modified: 23 October 2024