After every commit to the repository, this project is automatically deployed to AWS Amplify. Below are the steps to connect your GitHub project to AWS Amplify and set up continuous deployment.
Before starting, ensure you have:
- An AWS account. If you don't have one, sign up here.
- A GitHub repository with your project.
-
Log in to AWS Console:
- Navigate to the AWS Management Console.
- Search for Amplify in the AWS services search bar and open AWS Amplify.
-
Create a New Amplify App:
- Click Deploy App
-
Connect Your GitHub Repository:
- In the Repository service provider step, select GitHub.
- Click Next to authenticate with your GitHub account.
- Authorize AWS Amplify to access your GitHub repositories.
-
Choose Your Repository and Branch:
- Select the repository you want to connect.
- Choose the branch (e.g.,
main
) that should trigger deployments.
-
App settings:
- Give your app a name
- Amplify will automatically detect your project settings (like
React
). Review the default build settings or customize if needed. The default build settings for React projects are:version: 1 frontend: phases: preBuild: commands: - npm install build: commands: - npm run build artifacts: baseDirectory: build files: - '**/*' cache: paths: - node_modules/**/*
- More details in AWS Amplify Building Settings
-
Deploy Your App:
- Click Save and deploy.
- AWS Amplify will clone the repository and build and deploy the project.
-
Verify Deployment:
- After the deployment, Amplify will provide a URL where your app is hosted. Click the URL to view your app.
-
Automatic Deployments:
- Any future commits to the connected branch will trigger an automatic build and deployment on AWS Amplify.
- If your app requires environment variables, set them in the Environment Variables section of AWS Amplify.
For more details, check out the AWS Amplify Documentation.