Skip to content

Commit b12ad67

Browse files
committed
feat(infra): deploy to AWS dev environment via GitHub Actions
the web and streamlit services are deployed using the deploy workflow. to authenticate with AWS we use GitHub as an OIDC IdP.
1 parent bb5f525 commit b12ad67

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
needs: [tests-ui, tests-pytest]
3131
permissions:
3232
packages: write
33+
id-token: write
34+
contents: read
3335

3436
steps:
3537
- name: Checkout
@@ -57,34 +59,25 @@ jobs:
5759
- name: Write tag to file
5860
run: echo "${{ github.ref_name }}" >> pems/static/version.txt
5961

60-
- name: Docker Login to GitHub Container Registry
61-
uses: docker/login-action@v3
62+
- name: Configure AWS Credentials
63+
uses: aws-actions/configure-aws-credentials@v4
6264
with:
63-
registry: ghcr.io
64-
username: ${{ github.actor }}
65-
password: ${{ secrets.GITHUB_TOKEN }}
65+
role-to-assume: secrets.ROLE_TO_ASSUME
66+
aws-region: ${{ vars.AWS_REGION }}
6667

67-
- name: Set up QEMU
68-
uses: docker/setup-qemu-action@v3
68+
- name: Install AWS Copilot CLI
69+
run: |
70+
curl -Lo copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux
71+
chmod +x copilot
72+
sudo mv copilot /usr/local/bin/copilot
6973
70-
- name: Set up Docker Buildx
71-
id: buildx
72-
uses: docker/setup-buildx-action@v3
74+
- name: Deploy web Service
75+
run: |
76+
copilot deploy --name web --env dev
7377
74-
- name: Build, tag, and push image to GitHub Container Registry
75-
uses: docker/build-push-action@v6
76-
with:
77-
platforms: linux/amd64,linux/arm64
78-
builder: ${{ steps.buildx.outputs.name }}
79-
build-args: GIT-SHA=${{ github.sha }}
80-
cache-from: type=gha,scope=compilerla
81-
cache-to: type=gha,scope=compilerla,mode=max
82-
context: .
83-
file: appcontainer/Dockerfile
84-
push: true
85-
tags: |
86-
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
87-
ghcr.io/${{ github.repository }}:${{ github.sha }}
78+
- name: Deploy streamlit Service
79+
run: |
80+
copilot deploy --name streamlit --env dev
8881
8982
release:
9083
needs: deploy

0 commit comments

Comments
 (0)