Skip to content

Commit

Permalink
[MS-670] ci: Add build action (#31)
Browse files Browse the repository at this point in the history
* [MS-670] ci: Add build action

* [MS-670] feat: Adjust build CI
  • Loading branch information
piotrgrundas committed Oct 22, 2024
1 parent b2bdb82 commit f412805
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build

on:
push:
branches:
- "*"
tags:
- "*"

jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
AWS_DEFAULT_REGION: eu-central-1
steps:
- uses: actions/checkout@v4

- name: Create GIT_DESCRIBE variable
run: |
echo "GIT_DESCRIBE=$(git describe --broken --tags --always)" >> $GITHUB_ENV
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
run_install: false

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"

- name: Install dependencies
run: pnpm --version && pnpm install --frozen-lockfile

- name: Build zip
run: bash etc/commands/build.sh

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::414357773561:role/nimara-mailer
aws-region: eu-central-1

- name: Copy ZIP
run: aws s3 cp artifact.zip s3://marina-artifacts/lambda/lambda-mailer-${{ env.GIT_DESCRIBE }}.zip --quiet

- name: ZIP tag
run: echo "${{ env.GIT_DESCRIBE }}"
Binary file added lambda-mailer.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export const configSchema = z
SENTRY_DSN: z.string().url().optional(),

EMAIL_PROVIDER: z.enum(["NODE_MAILER", "AWS_SES"]).default("AWS_SES"),

BASE_PATH: z.string().default("").optional(),
})
.and(commonConfigSchema)
.and(appConfigSchema)
Expand Down
4 changes: 1 addition & 3 deletions src/lib/config/schema.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { z } from "zod";

export const commonConfigSchema = z.object({
ENVIRONMENT: z
.enum(["development", "local", "test", "production"])
.default("production"),
ENVIRONMENT: z.string().default("dev"),
IS_BROWSER: z.boolean().default(typeof window !== "undefined"),
IS_DEVELOPMENT: z.boolean().default(process.env.NODE_ENV === "development"),
IS_TEST: z.boolean().default(process.env.NODE_ENV === "test"),
Expand Down
2 changes: 1 addition & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function createServer() {
* Apis registration
*/
await server.register(restRoutes, {
prefix: "/api",
prefix: `${CONFIG.BASE_PATH}/api`,
});

server.log.info("Registering plugins", { registrations });
Expand Down

0 comments on commit f412805

Please sign in to comment.