forked from SPARCS-UP-Mindanao/TechTix
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (58 loc) · 1.93 KB
/
deploy_backend.yml
File metadata and controls
69 lines (58 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Deploy DurianPy Events Service
on:
push:
paths:
- backend/**
branches:
- main
- stage
workflow_dispatch:
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set ARN for Role to Assume
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "AWS_OIDC_ROLE_ARN=${{ secrets.AWS_OIDC_ROLE_ARN_PROD }}" >> $GITHUB_ENV
elif [[ "${{ github.ref }}" == "refs/heads/stage" ]]; then
echo "AWS_OIDC_ROLE_ARN=${{ secrets.AWS_OIDC_ROLE_ARN_STAGE }}" >> $GITHUB_ENV
fi
- name: Configure AWS Credentials
uses: aws-actions/[email protected]
with:
audience: sts.amazonaws.com
aws-region: ap-southeast-1
role-to-assume: ${{ env.AWS_OIDC_ROLE_ARN }}
role-session-name: GithubActionSession
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "backend/.python-version"
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Install dependencies
run: |
uv sync --locked --all-extras --dev
working-directory: backend
- name: Install Serverless Framework
run: |
npm install
npm install -g [email protected]
working-directory: backend
- name: Create requirements.txt
run: uv export --format requirements-txt --no-hashes --output-file requirements.txt --no-dev
working-directory: backend
- name: Deploy with Serverless v3
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
sls deploy --stage prod --verbose
elif [[ "${{ github.ref }}" == "refs/heads/stage" ]]; then
sls deploy --stage dev --verbose
fi
working-directory: backend