Skip to content

Commit 1cc1f20

Browse files
Merge pull request #112 from Kobzol/ci-deployment
Add a CI job for deploying to production
2 parents 2ab9b1a + 1961109 commit 1cc1f20

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ on:
88
concurrency: deploy
99

1010
jobs:
11-
deploy:
11+
deploy-to-staging:
1212
name: Deploy
1313
runs-on: ubuntu-latest
14+
environment: staging
15+
concurrency: staging
1416
permissions:
1517
id-token: write
1618
contents: read
@@ -44,3 +46,41 @@ jobs:
4446

4547
- name: Kick ECS to deploy new version
4648
run: aws ecs update-service --service bors --cluster bors --force-new-deployment
49+
deploy-to-production:
50+
name: Deploy
51+
runs-on: ubuntu-latest
52+
environment: production
53+
concurrency: production
54+
permissions:
55+
id-token: write
56+
contents: read
57+
steps:
58+
- name: Checkout repo
59+
uses: actions/checkout@v3
60+
61+
- name: Configure AWS credentials
62+
uses: aws-actions/configure-aws-credentials@v2
63+
with:
64+
role-to-assume: arn:aws:iam::351621253146:role/gha-access
65+
aws-region: us-east-2
66+
67+
- name: Login to Amazon ECR
68+
id: login-ecr
69+
uses: aws-actions/amazon-ecr-login@v1
70+
71+
- uses: docker/setup-buildx-action@v2
72+
- name: Build and tag the Docker image
73+
env:
74+
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
75+
REPOSITORY: bors
76+
IMAGE_TAG: latest
77+
uses: docker/build-push-action@v4
78+
with:
79+
context: .
80+
tags: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }}
81+
push: true
82+
cache-from: type=gha
83+
cache-to: type=gha,mode=max
84+
85+
- name: Kick ECS to deploy new version
86+
run: aws ecs update-service --service bors --cluster bors --force-new-deployment

0 commit comments

Comments
 (0)