Skip to content

Commit 4b92b70

Browse files
committed
Add pipeline for deploy to new infra
1 parent 7e4384e commit 4b92b70

2 files changed

Lines changed: 62 additions & 5 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy
2+
3+
permissions:
4+
id-token: write
5+
contents: read
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- 'release/pr-v*'
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
environment: ${{ inputs.deploy-env || (github.ref_name == 'main' && 'Development') || (startsWith(github.ref_name, 'release/pr-v') && 'Production') || 'None' }}
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: aws-actions/configure-aws-credentials@v4
22+
with:
23+
role-to-assume: ${{ vars.PIPELINE_ROLE_ARN }}
24+
aws-region: ${{ vars.AWS_REGION }}
25+
26+
- uses: aws-actions/amazon-ecr-login@v2
27+
28+
- name: Build and push image
29+
id: build
30+
run: |
31+
IMAGE_TAG=${{ github.sha }}
32+
docker build -t ${{ vars.ECR_URL }}:$IMAGE_TAG .
33+
docker push ${{ vars.ECR_URL }}:$IMAGE_TAG
34+
echo "image=${{ vars.ECR_URL }}:$IMAGE_TAG" >> $GITHUB_OUTPUT
35+
36+
- name: Get current task definition
37+
run: |
38+
aws ecs describe-task-definition \
39+
--task-definition ${{ vars.TASK_FAMILY }} \
40+
--query taskDefinition \
41+
> task-definition.json
42+
43+
- name: Update image in task definition
44+
id: render
45+
uses: aws-actions/amazon-ecs-render-task-definition@v1
46+
with:
47+
task-definition: task-definition.json
48+
container-name: ${{ vars.CONTAINER_NAME }}
49+
image: ${{ steps.build.outputs.image }}
50+
51+
- name: Deploy to ECS
52+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
53+
with:
54+
task-definition: ${{ steps.render.outputs.task-definition }}
55+
service: ${{ vars.ECS_SERVICE }}
56+
cluster: ${{ vars.ECS_CLUSTER }}
57+
wait-for-service-stability: true

.github/workflows/deploy_to_railway.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ permissions:
44
contents: read
55

66
on:
7-
push:
8-
branches:
9-
- main
10-
- staging
11-
- 'release/pr-v*'
7+
# push:
8+
# branches:
9+
# # - main
10+
# # - staging
11+
# # - 'release/pr-v*'
1212

1313
workflow_dispatch:
1414
inputs:

0 commit comments

Comments
 (0)