Skip to content

Commit b217e44

Browse files
committed
chore: deploy action for consumer, also linux now
1 parent 7b93510 commit b217e44

File tree

126 files changed

+11182
-11188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+11182
-11188
lines changed

.github/workflows/api-deploy.yml

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,51 @@
1-
name: API Lambda Deploy ⁁
2-
on:
3-
push:
4-
branches:
5-
- main
6-
paths:
7-
- api/**
8-
- .github/workflows/api-deploy.yml
9-
tags:
10-
- '*.*.*'
11-
permissions:
12-
contents: read
13-
14-
jobs:
15-
build-deploy:
16-
environment: ${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }}
17-
name: Build & Deploy 📦
18-
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
working-directory: ./api
22-
23-
24-
steps:
25-
- uses: actions/checkout@v4
26-
- name: Set up Python
27-
uses: actions/setup-python@v4
28-
with:
29-
python-version: "3.11"
30-
- name: Setup AWS CLI
31-
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
32-
with:
33-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
34-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
35-
aws-region: ${{ secrets.AWS_REGION }}
36-
- name: Install dependencies
37-
run: |
38-
pip install cargo-lambda
39-
cargo install sqlx-cli
40-
- name: Rust Cache
41-
uses: Swatinem/rust-cache@v2
42-
with:
43-
workspaces: |
44-
api
45-
- name: Build
46-
run: cargo lambda build --release --output-format zip
47-
48-
- name: Migrate Database
49-
env:
50-
DSQL_ENDPOINT: ${{ secrets.DSQL_ENDPOINT }}
51-
run: |
52-
token=$(aws dsql generate-db-connect-admin-auth-token --hostname $DSQL_ENDPOINT)
53-
encoded_token=$(echo "$token" | jq -Rr @uri)
54-
sqlx migrate run --database-url "postgresql://admin:${encoded_token}@${DSQL_ENDPOINT}/postgres?sslmode=require"
55-
56-
- name: Upload to Lambda
57-
run: aws lambda update-function-code --function-name kb2-lambda-function-${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }} --zip-file fileb://target/lambda/api/bootstrap.zip
1+
name: API Lambda Deploy ⁁
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- api/**
8+
- .github/workflows/api-deploy.yml
9+
tags:
10+
- '*.*.*'
11+
workflow_dispatch: []
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build-deploy:
17+
environment: ${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }}
18+
name: Build & Deploy 📦
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup AWS CLI
23+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
24+
with:
25+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
26+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
27+
aws-region: ${{ secrets.AWS_REGION }}
28+
- name: Rust Cache
29+
uses: Swatinem/rust-cache@v2
30+
- name: Install dependencies
31+
run: |
32+
curl -fsSL https://cargo-lambda.info/install.sh | sh
33+
cargo install sqlx-cli
34+
- name: Build
35+
run: cargo lambda build --release --output-format zip -p api -p consumer
36+
37+
- name: Migrate Database
38+
env:
39+
DSQL_ENDPOINT: ${{ secrets.DSQL_ENDPOINT }}
40+
run: |
41+
cd api
42+
token=$(aws dsql generate-db-connect-admin-auth-token --hostname $DSQL_ENDPOINT)
43+
encoded_token=$(echo "$token" | jq -Rr @uri)
44+
sqlx migrate run --database-url "postgresql://admin:${encoded_token}@${DSQL_ENDPOINT}/postgres?sslmode=require"
45+
cd ..
46+
47+
- name: Upload api to Lambda
48+
run: aws lambda update-function-code --function-name kb2-lambda-function-${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }} --zip-file fileb://target/lambda/api/bootstrap.zip
49+
50+
- name: Upload consumer to Lambda
51+
run: aws lambda update-function-code --function-name kb2-lambda-consumer-${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }} --zip-file fileb://target/lambda/consumer/bootstrap.zip

.github/workflows/ui-deploy.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
name: UI S3 Deploy 📦🪣
2-
on:
3-
push:
4-
branches:
5-
- main
6-
paths:
7-
- ui/**
8-
- ui-deploy.yml
9-
tags:
10-
- '*.*.*'
11-
permissions:
12-
contents: read
13-
14-
jobs:
15-
build-deploy:
16-
environment: ${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }}
17-
name: Build & Deploy 🪣
18-
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
working-directory: ./ui
22-
23-
steps:
24-
- uses: actions/checkout@v4
25-
26-
- name: Set up Node
27-
uses: actions/setup-node@v4
28-
with:
29-
node-version: 22
30-
31-
- name: Install npm requirements
32-
run: npm install
33-
34-
- name: Build npm
35-
run: npm run build
36-
env:
37-
VITE_KB_API_URL: ${{ vars.VITE_KB_API_URL }}
38-
VITE_DISCORD_CLIENT_ID: ${{ vars.VITE_DISCORD_CLIENT_ID }}
39-
VITE_GOOGLE_CLIENT_ID: ${{ vars.VITE_GOOGLE_CLIENT_ID }}
40-
VITE_MICROSOFT_CLIENT_ID: ${{ vars.VITE_MICROSOFT_CLIENT_ID }}
41-
42-
- name: Setup AWS CLI
43-
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
44-
with:
45-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
46-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47-
aws-region: eu-west-2
48-
49-
- name: Deploy Modified Files
1+
name: UI S3 Deploy 📦🪣
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- ui/**
8+
- ui-deploy.yml
9+
tags:
10+
- '*.*.*'
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
build-deploy:
16+
environment: ${{ github.ref == 'refs/heads/main' && 'dev' || 'prod' }}
17+
name: Build & Deploy 🪣
18+
runs-on: ubuntu-latest
19+
defaults:
20+
run:
21+
working-directory: ./ui
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Set up Node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22
30+
31+
- name: Install npm requirements
32+
run: npm install
33+
34+
- name: Build npm
35+
run: npm run build
36+
env:
37+
VITE_KB_API_URL: ${{ vars.VITE_KB_API_URL }}
38+
VITE_DISCORD_CLIENT_ID: ${{ vars.VITE_DISCORD_CLIENT_ID }}
39+
VITE_GOOGLE_CLIENT_ID: ${{ vars.VITE_GOOGLE_CLIENT_ID }}
40+
VITE_MICROSOFT_CLIENT_ID: ${{ vars.VITE_MICROSOFT_CLIENT_ID }}
41+
42+
- name: Setup AWS CLI
43+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
44+
with:
45+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
46+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
47+
aws-region: eu-west-2
48+
49+
- name: Deploy Modified Files
5050
run: aws s3 sync --delete ./dist s3://${{vars.AWS_S3_BUCKET}}

0 commit comments

Comments
 (0)