Skip to content

Commit 0e8a775

Browse files
committed
tweak: content type of markdown
1 parent 607b313 commit 0e8a775

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

.github/workflows/production.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ jobs:
126126
--secret-key ${{ secrets.TENCENTCLOUD_SECRET_KEY }} \
127127
--endpoint cos.na-ashburn.myqcloud.com \
128128
--delete \
129+
--exclude ".*\.md$" \
130+
--force
131+
132+
- name: Deploy md to COS
133+
run: |
134+
./coscli sync public/ cos://${{ secrets.TENCENTCLOUD_BUCKET_ID }} \
135+
--init-skip \
136+
--recursive \
137+
--routines 16 \
138+
--secret-id ${{ secrets.TENCENTCLOUD_SECRET_ID }} \
139+
--secret-key ${{ secrets.TENCENTCLOUD_SECRET_KEY }} \
140+
--endpoint cos.na-ashburn.myqcloud.com \
141+
--include ".*\.md$" \
142+
--meta="ContentType:text/plain; charset=utf-8" \
129143
--force
130144
131145
cdn-refresh:

gatsby/cp-markdown.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@ export const cpMarkdown = (
66
destpath: string,
77
filename: string
88
) => {
9-
if (!filename) {
10-
return;
11-
}
129
const sourceDir = path.resolve(
1310
__dirname,
1411
`../docs/markdown-pages/${filepath}`
1512
);
16-
const destDir = path.resolve(
17-
__dirname,
18-
`../public/${destpath}/${filename}.md`
19-
);
13+
14+
let _destpath = destpath;
15+
16+
if (!filename) {
17+
_destpath = destpath.endsWith("/")
18+
? destpath.slice(0, destpath.length - 1)
19+
: destpath;
20+
}
21+
22+
const destDir = path.resolve(__dirname, `../public/${_destpath}.md`);
23+
2024
fs.copy(sourceDir, destDir).catch((e) => console.warn(e.toString()));
2125
};

0 commit comments

Comments
 (0)