-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CD with github actions #704
Conversation
.github/workflows/cd.yml
Outdated
on: | ||
push: | ||
branches: | ||
- main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe if we comment this part the job doesn't run by default (what we want) and in the docs we can clarify that they need to uncomment it if they are willing to deploy to AWS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to what we did here:
rails_api_base/.github/workflows/update_knapsack_report.yml
Lines 3 to 8 in f999c2f
on: | |
workflow_dispatch: | |
# This workflow should be scheduled at certain intervals | |
# schedule: | |
# - cron: '0 0 1 */3 *' | |
# The above cron would schedule it every 3 months. Replace with the wanted periodicity. |
And we can even add worfklow_dispatch so that it can be manually triggered
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! LGTM 🤩
.github/workflows/cd.yml
Outdated
# on: | ||
# push: | ||
# Uncomment and add the necessary branches to enable automatic deployment on AWS | ||
# branches: | ||
# - main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only doubt I have is if having the on
section completely commented might make the GHA invalid
Other option would be doing the same as here
on:
workflow_dispatch:
# Uncomment and add the necessary branches to enable automatic deployment on AWS
# push:
# branches:
# - main
.github/workflows/cd.yml
Outdated
environment: | ||
name: ${{ github.ref_name }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, this requires us to create a Github environment and a branch with the exact same name. If we are forcing any naming convention, we should add it to the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also wondering if we should keep track of all the releases using the "Github releases" feature, and I think that relies on tagging instead of branch pushes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using "GitHub releases" based on tagging could be an interesting idea to track all releases. It offers a structured approach with release notes and contributors. However, it requires a different setup from the process investigated in this PR. Let's consider exploring this in a separate card and PR for future enhancements.
.github/workflows/cd.yml
Outdated
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why we do this manually instead of using docker/build-push-action? I think you can get the imageID as well using it
docs/cd_with_aws.md
Outdated
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These secrets are environment specific right? Maybe we should clarify that these are not repo level settings, but environment level
docs/cd_with_aws.md
Outdated
on: | ||
push: | ||
branches: | ||
- main | ||
- dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on:
push:
branches:
- main
- dev
you can use a yaml block code here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏 Looks Great!
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammarly suggestion
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. | |
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 names as the environment. All environments added in GitHub must have the same name as the branches. |
- `ECS_CLUSTER`: The name of your ECS cluster. | ||
|
||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammarly suggestion
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. | |
To set up the GitHub Actions workflow for continuous deployment to AWS, you need to modify the existing cd.yml file in your GitHub repository's `.github/workflows` directory. |
Board:
Description:
Why:
To streamline app deployment, enhancing team efficiency. Utilizing GitHub Actions centralizes processes, aiding devs familiar with the repo.
Documentation:
GitHub CD Documentation