Skip to content

Commit

Permalink
fix main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoparma88 committed Jun 11, 2024
1 parent 50fd383 commit 6522376
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Deploy on AWS ECS
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
name: ${{ github.ref == 'refs/heads/main' && 'production' || github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
9 changes: 7 additions & 2 deletions docs/cd_with_aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Before you start, make sure you have the following:
- AWS Secret Access Key
- These credentials should have permission to interact with ECR and ECS.

4. **GitHub Repository Setup**:
4. **Create Environments**:

The GitHub Actions workflow will automatically deploy to the correct environment based on the branch being pushed to. The branch `main` will always be linked to the `production` environment, while other branches will use their own names as the environment. All environments added in GitHub must have the same name as the branches.

5. **GitHub Repository Setup**:
- Secrets: Add the following secrets to your GitHub repository:
- `AWS_ACCESS_KEY_ID`: Your AWS Access Key ID.
- `AWS_SECRET_ACCESS_KEY`: Your AWS Secret Access Key.
Expand All @@ -30,7 +34,7 @@ Before you start, make sure you have the following:
- `ECS_SERVICE`: The name of your ECS service.
- `ECS_CLUSTER`: The name of your ECS cluster.

5. **GitHub Actions Workflow**:
6. **GitHub Actions Workflow**:
To set up the GitHub Actions workflow for continuous deployment to AWS, you need to modify the existing cd.yml file in the .github/workflows directory of your GitHub repository.
Uncomment the branches section under on: push: and add the necessary branches to enable automatic deployment. For example:

Expand All @@ -39,3 +43,4 @@ on:
branches:
- main
- dev

0 comments on commit 6522376

Please sign in to comment.