Skip to content

Commit bf31bb9

Browse files
committed
Use lowercase module names for S3 storage; fix deploy assets
1 parent 1a8fc99 commit bf31bb9

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ jobs:
2727
2828
- name: Archive standalone output
2929
run: |
30-
tar -czf next.tar.gz .next
30+
cp -r public .next/standalone
31+
cp -r .next/static .next/standalone/.next
32+
tar -czf next.tar.gz .next/standalone
3133
3234
- name: Copy build to EC2
3335
uses: appleboy/[email protected]
@@ -48,9 +50,8 @@ jobs:
4850
set -e
4951
cd ~/app
5052
51-
rm -rf server
52-
mkdir -p server
53-
tar -xzf next.tar.gz -C server
53+
rm -rf .next
54+
tar -xzf next.tar.gz
5455
5556
pm2 delete website || true
5657
pm2 start ecosystem.config.js

app/api/(utils)/storage.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class FileStorage implements AppStorage {
8585
releaseId: string,
8686
file: Buffer,
8787
): Promise<void> {
88-
const releaseFolder = `${this.#directory}/modules/${moduleName}/${releaseId}`;
88+
const releaseFolder = `${this.#directory}/modules/${moduleName.toLowerCase()}/${releaseId}`;
8989
await fs.mkdir(releaseFolder, { recursive: true });
9090
const fileName = type === "scripts" ? "scripts.zip" : "metadata.json";
9191
await fs.writeFile(`${releaseFolder}/${fileName}`, new Uint8Array(file));
@@ -139,7 +139,7 @@ export class S3Storage implements AppStorage {
139139
const response = await this.#client.send(
140140
new GetObjectCommand({
141141
Bucket: this.#bucketName,
142-
Key: `/public/images/${type}s/${name}.png`,
142+
Key: `/public/images/${type}s/${name.toLowerCase()}.png`,
143143
}),
144144
);
145145

@@ -159,7 +159,7 @@ export class S3Storage implements AppStorage {
159159
const response = await this.#client.send(
160160
new GetObjectCommand({
161161
Bucket: this.#bucketName,
162-
Key: `/public/modules/${moduleName}/${releaseId}/${fileName}`,
162+
Key: `/public/modules/${moduleName.toLowerCase()}/${releaseId}/${fileName}`,
163163
}),
164164
);
165165

@@ -174,7 +174,7 @@ export class S3Storage implements AppStorage {
174174
const response = await this.#client.send(
175175
new PutObjectCommand({
176176
Bucket: this.#bucketName,
177-
Key: `/public/images/${type}s/${name}.png`,
177+
Key: `/public/images/${type}s/${name.toLowerCase()}.png`,
178178
Body: await file.toBuffer(),
179179
ACL: "public-read",
180180
}),
@@ -195,7 +195,7 @@ export class S3Storage implements AppStorage {
195195
const response = await this.#client.send(
196196
new PutObjectCommand({
197197
Bucket: this.#bucketName,
198-
Key: `/public/modules/${moduleName}/${releaseId}/${fileName}`,
198+
Key: `/public/modules/${moduleName.toLowerCase()}/${releaseId}/${fileName}`,
199199
Body: file,
200200
}),
201201
);

0 commit comments

Comments
 (0)