-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adding github workflows for deploy #93
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bc0e205
Adding dev git workflow
manasaV3 955260a
Fixing frontend context
manasaV3 e610400
Adding dev deploy workflow
manasaV3 1ed632c
Adding staging deployment workflow
manasaV3 ef99fb8
Adding concurrency limit
manasaV3 cee72e7
Adding prod deploy
manasaV3 21ba30f
Updating prod to deploy on merge
manasaV3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Deploy to dev cluster | ||
|
||
on: | ||
push: | ||
branches: | ||
- "dev-*" | ||
delete: | ||
branches: | ||
- "dev-*" | ||
|
||
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
jobs: | ||
deploy-to-dev: | ||
name: deploy dev branch | ||
runs-on: ubuntu-latest | ||
environment: dev | ||
if: github.repository == 'chanzuckerberg/cryoet-data-portal' | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
mask-aws-account-id: true | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-duration-seconds: 1200 | ||
- name: Login to ECR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.ECR_REPO }} | ||
- name: Setting up stack name | ||
run: | | ||
if [[ ${#GITHUB_REF_NAME} -gt 32 ]]; then | ||
echo "branch name: ${GITHUB_REF_NAME}, length ${#GITHUB_REF_NAME}, is $((${#GITHUB_REF_NAME} - 32)) characters too long, please use a branch name that's 32 characters or shorter" | ||
exit 1 | ||
else | ||
echo $GITHUB_REF_NAME | tr '[:upper:]' '[:lower:]' | xargs -I {} -n 1 echo STACK_NAME={} >> $GITHUB_ENV | ||
fi | ||
- name: Create or update dev stack | ||
if: ${{ github.event_name == 'push' }} | ||
uses: chanzuckerberg/github-actions/.github/actions/[email protected] | ||
env: | ||
# Force using BuildKit instead of normal Docker, required so that metadata | ||
# is written/read to allow us to use layers of previous builds as cache. | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
DOCKER_REPO: ${{ secrets.ECR_REPO }}/ | ||
ENV: dev | ||
with: | ||
stack-name: ${{ env.STACK_NAME }} | ||
create-tag: true | ||
tag: ${{ env.STACK_NAME }} | ||
tfe-token: ${{ secrets.TFE_TOKEN }} | ||
working-directory: ./frontend | ||
env: dev | ||
operation: create-or-update | ||
|
||
- name: Delete dev set up stack name | ||
if: ${{ github.event_name == 'delete' && startsWith(github.event.ref, 'dev-') }} | ||
run: | | ||
echo ${{ github.event.ref }} | tr '[:upper:]' '[:lower:]' | xargs -I {} -n 1 echo DELETE_STACK_NAME={} >> $GITHUB_ENV | ||
- name: Delete dev | ||
if: ${{ github.event_name == 'delete' && startsWith(github.event.ref, 'dev-') }} | ||
uses: chanzuckerberg/github-actions/.github/actions/[email protected] | ||
env: | ||
ENV: dev | ||
with: | ||
stack-name: ${{ env.DELETE_STACK_NAME }} | ||
operation: delete | ||
tfe-token: ${{ secrets.TFE_TOKEN }} | ||
env: dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
||
deploy-to-prod: | ||
name: deploy prod branch | ||
runs-on: ubuntu-latest | ||
environment: prod | ||
if: github.repository == 'chanzuckerberg/cryoet-data-portal' | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
mask-aws-account-id: true | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-duration-seconds: 1200 | ||
- name: Login to ECR | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to do this step |
||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.ECR_REPO }} | ||
- name: Create or update stack | ||
uses: chanzuckerberg/github-actions/.github/actions/[email protected] | ||
env: | ||
# Force using BuildKit instead of normal Docker, required so that metadata | ||
# is written/read to allow us to use layers of previous builds as cache. | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
DOCKER_REPO: ${{ secrets.ECR_REPO }}/ | ||
ENV: prod | ||
with: | ||
stack-name: prod | ||
create-tag: true | ||
tag: ${{ env.STACK_NAME }} | ||
tfe-token: ${{ secrets.TFE_TOKEN }} | ||
working-directory: ./frontend | ||
env: prod | ||
operation: create-or-update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Deploy to staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- "main" | ||
|
||
# https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
deploy-to-staging: | ||
name: deploy staging branch | ||
runs-on: ubuntu-latest | ||
environment: staging | ||
if: github.repository == 'chanzuckerberg/cryoet-data-portal' | ||
steps: | ||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
mask-aws-account-id: true | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-duration-seconds: 1200 | ||
- name: Login to ECR | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ secrets.ECR_REPO }} | ||
- name: Create or update stack | ||
uses: chanzuckerberg/github-actions/.github/actions/[email protected] | ||
env: | ||
# Force using BuildKit instead of normal Docker, required so that metadata | ||
# is written/read to allow us to use layers of previous builds as cache. | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
DOCKER_REPO: ${{ secrets.ECR_REPO }}/ | ||
ENV: staging | ||
with: | ||
stack-name: staging | ||
create-tag: true | ||
tag: ${{ env.STACK_NAME }} | ||
tfe-token: ${{ secrets.TFE_TOKEN }} | ||
working-directory: ./frontend | ||
env: staging | ||
operation: create-or-update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
are we always going to push
main
to prod?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.
Yeah, we will deploy to prod on every push for the moment.