Skip to content

Commit 71fe97f

Browse files
committed
TCLOUD-4780: Switch to using PR number instead of branch name
1 parent a11cada commit 71fe97f

File tree

3 files changed

+16
-38
lines changed

3 files changed

+16
-38
lines changed

.github/workflows/preview_create.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
name: Preview Create/Update
22

33
on:
4-
create:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
59
branches-ignore:
610
- 'main'
711
- 'develop'
812
- 'tinymce/**'
913
- 'release/**'
1014
- 'archived/**'
1115

12-
push:
13-
branches-ignore:
14-
- 'main'
15-
- 'develop'
16-
- 'tinymce/**'
17-
- 'release/**'
18-
- 'archived/**'
1916

2017
# Need ID token write permission to use OIDC
2118
permissions:
2219
id-token: write
2320

21+
env:
22+
PR_NUMBER: ${{ github.event.number }}
23+
2424
jobs:
2525

2626
build:
@@ -52,12 +52,6 @@ jobs:
5252
run: |
5353
mv ./build/site/sitemap.xml ./build/site/antora-sitemap.xml
5454
55-
- name: Convert branch into subdomain
56-
id: get-subdomain
57-
working-directory: ./.github/workflows/scripts
58-
run: |
59-
node ./branch-to-subdomain.js >> $GITHUB_OUTPUT
60-
6155
- name: configure aws credentials
6256
uses: aws-actions/[email protected]
6357
with:
@@ -67,6 +61,4 @@ jobs:
6761

6862
- name: Upload website preview to S3
6963
run: |
70-
aws s3 sync --delete ./build/site s3://tiny-cloud-antora-docs-preview/${SUBDOMAIN}/docs
71-
env:
72-
SUBDOMAIN: ${{ steps.get-subdomain.outputs.subdomain }}
64+
aws s3 sync --delete ./build/site s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}/docs

.github/workflows/preview_delete.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
name: Preview Delete
22

33
on:
4-
delete:
4+
pull_request:
5+
types:
6+
- closed
57
branches-ignore:
68
- 'main'
79
- 'develop'
@@ -13,6 +15,9 @@ on:
1315
permissions:
1416
id-token: write
1517

18+
env:
19+
PR_NUMBER: ${{ github.event.number }}
20+
1621
jobs:
1722
cleanup:
1823
name: Cleanup Docs Preview
@@ -33,12 +38,6 @@ jobs:
3338
cache: 'yarn'
3439
node-version: 24
3540

36-
- name: Convert branch into subdomain
37-
id: get-subdomain
38-
working-directory: ./.github/workflows/scripts
39-
run: |
40-
node ./branch-to-subdomain.js >> $GITHUB_OUTPUT
41-
4241
- name: configure aws credentials
4342
uses: aws-actions/[email protected]
4443
with:
@@ -48,6 +47,4 @@ jobs:
4847

4948
- name: Remove website preview from S3
5049
run: |
51-
aws s3 rm s3://tiny-cloud-antora-docs-preview/${SUBDOMAIN}/docs
52-
env:
53-
SUBDOMAIN: ${{ steps.get-subdomain.outputs.subdomain }}
50+
aws s3 rm s3://tiny-cloud-antora-docs-preview/pr${PR_NUMBER}

.github/workflows/scripts/branch-to-subdomain.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)