Skip to content

Commit 4e0c655

Browse files
authored
Chore: adjust AWS permissions for deploy workflow (#142)
2 parents ea36375 + 09b680a commit 4e0c655

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Troubleshoot
2+
3+
on: workflow_dispatch
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
packages: write
14+
id-token: write
15+
contents: read
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version-file: .github/workflows/.python-version
24+
cache: pip
25+
cache-dependency-path: "**/pyproject.toml"
26+
27+
- name: Write python packages to file
28+
run: |
29+
python -m venv .venv
30+
source .venv/bin/activate
31+
pip install pipdeptree
32+
pip install -e .
33+
mkdir -p pems/static
34+
pipdeptree
35+
pipdeptree >> pems/static/requirements.txt
36+
37+
- name: Write commit SHA to file
38+
run: echo "${{ github.sha }}" >> pems/static/sha.txt
39+
40+
- name: Write tag to file
41+
run: echo "${{ github.ref_name }}" >> pems/static/version.txt
42+
43+
- name: Configure AWS Credentials
44+
uses: aws-actions/configure-aws-credentials@v4
45+
with:
46+
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
47+
aws-region: ${{ vars.AWS_REGION }}
48+
49+
- name: Install AWS Copilot CLI
50+
run: |
51+
mkdir -p ./.tools
52+
curl -Lo ./.tools/copilot https://github.com/aws/copilot-cli/releases/latest/download/copilot-linux
53+
chmod +x ./.tools/copilot
54+
sudo mv ./.tools/copilot /usr/local/bin/copilot
55+
56+
- name: Deploy web Service
57+
run: |
58+
copilot deploy --name web --env dev
59+
working-directory: ./infra
60+
61+
- name: Deploy streamlit Service
62+
run: |
63+
copilot deploy --name streamlit --env dev
64+
working-directory: ./infra

0 commit comments

Comments
 (0)