Skip to content

Commit 5de8be1

Browse files
authored
Merge pull request #6 from ga4gh/ci-github-actions
CI GitHub actions
2 parents 4e7d4a6 + 2b97f1b commit 5de8be1

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/develop.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# this workflow is triggered when a PR to the develop branch is merged.
2+
# the following steps are performed:
3+
# - build docker image and push to ECR (image tag is the git describe output as well as 'latest')
4+
# - deploy image to staging environment
5+
name: develop branch workflow
6+
on:
7+
push:
8+
branches:
9+
- develop
10+
- main # temporary until we get a "develop" branch set up
11+
- ci-github-actions # temporary branch for testing, to be removed once workflow is verified
12+
permissions:
13+
id-token: write
14+
jobs:
15+
build-push-deploy:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: checkout code
19+
id: checkout-code
20+
uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: save command output
25+
id: save-command-output
26+
run: |
27+
echo "DOCKER_REPO=analytics-dashboard-ui" >> $GITHUB_ENV
28+
echo "DOCKER_TAG=$(git describe)" >> $GITHUB_ENV
29+
30+
- name: build docker image
31+
id: build-docker-image
32+
run: docker build -t ${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }} -t ${{ env.DOCKER_REPO }}:latest .
33+
34+
- name: configure aws credentials
35+
id: configure-aws-credentials
36+
uses: aws-actions/configure-aws-credentials@v6.1.0
37+
with:
38+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
39+
aws-region: ${{ secrets.AWS_REGION }}
40+
41+
- name: push to ecr
42+
id: push-to-ecr
43+
uses: jwalton/gh-ecr-push@v2
44+
with:
45+
region: ${{ secrets.AWS_REGION }}
46+
local-image: ${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }}
47+
image: ${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }}, ${{ env.DOCKER_REPO }}:latest
48+
49+
- name: render ecs task definition
50+
id: render-ecs-task-definition
51+
uses: aws-actions/amazon-ecs-render-task-definition@v1
52+
with:
53+
task-definition-arn: ${{ secrets.AWS_ECS_TASK_DEFINITION_ARN }}
54+
container-name: ${{ secrets.AWS_ECS_CONTAINER_NAME }}
55+
image: ${{ secrets.AWS_ECR_REGISTRY}}/${{ env.DOCKER_REPO }}:${{ env.DOCKER_TAG }}
56+
57+
- name: deploy to ecs service
58+
id: deploy-to-ecs-service
59+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
60+
with:
61+
task-definition: ${{ steps.render-ecs-task-definition.outputs.task-definition }}
62+
service: ${{ secrets.AWS_ECS_SERVICE_NAME }}
63+
cluster: ${{ secrets.AWS_ECS_CLUSTER_NAME }}
64+
wait-for-service-stability: true

0 commit comments

Comments
 (0)