Skip to content

Commit 28a707f

Browse files
committed
TCLOUD-4780: Ensure the clean up of redirects
1 parent 1f7bd30 commit 28a707f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

.github/workflows/preview_create.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,13 @@ jobs:
4242
- name: Build Website
4343
run: yarn antora ./antora-playbook.yml
4444

45+
- name: Rename site
46+
run: |
47+
mv ./build/site ./build/docs
48+
4549
- name: Rename sitemap.xml
4650
run: |
47-
mv ./build/site/sitemap.xml ./build/site/antora-sitemap.xml
51+
mv ./build/docs/sitemap.xml ./build/docs/antora-sitemap.xml
4852
4953
- name: configure aws credentials
5054
uses: aws-actions/[email protected]
@@ -55,8 +59,7 @@ jobs:
5559

5660
- name: Upload website preview to S3 # put in the docs subfolder as we rely on that path in redirects
5761
run: |
58-
aws s3 rm s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}
59-
aws s3 sync ./build/site s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}/docs
62+
aws s3 sync --delete ./build s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}
6063
6164
- name: Create redirects on S3
6265
run: node ./.github/workflows/scripts/generate_redirects.mjs tiny-cloud-antora-docs-preview pr${PR_NUMBER}

.github/workflows/scripts/generate_redirects.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const dryRunSuccess = (cmd) => new Promise((resolve) => {
4949
function checkS3ObjectExists(_dryRun, _bucket, _prefix, subPath) {
5050
// it's too slow to talk to s3, so just check the local files we just uploaded...
5151
if (subPath.startsWith('docs/')) {
52-
return fs.existsSync(path.join(import.meta.dirname, '../../../build/site', subPath.slice('docs/'.length)));
52+
return fs.existsSync(path.join(import.meta.dirname, '../../../build', subPath));
5353
} else {
5454
return false;
5555
}
@@ -84,7 +84,7 @@ const copyS3ObjectWithMetadataAsync = async (dryRun, bucket, prefix, subPath, me
8484
'aws', 's3api', 'copy-object',
8585
'--bucket', bucket,
8686
'--copy-source', `${bucket}/${fullPath}`,
87-
'--key', subPath,
87+
'--key', fullPath,
8888
'--metadata-directive', 'REPLACE',
8989
'--content-type', 'text/html',
9090
...metadataArgs(metadata)

0 commit comments

Comments
 (0)