Skip to content

Commit 3194cd0

Browse files
committed
Rename dispatch-env to publish-env for consistency
dispatch-env and publish-env were the same value under two different names once the vocabulary was unified - reusable-docs-build.yml's input and the docs-publish payload were already publish-env/publish_env, so docs-generate-html.yml's own input was the odd one out.
1 parent 3b30d4d commit 3194cd0

2 files changed

Lines changed: 24 additions & 25 deletions

File tree

.github/workflows/docs-generate-html.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,38 @@ on:
1515
description: 'The git ref to build from'
1616
type: string
1717
required: true
18-
dispatch-env:
18+
publish-env:
1919
description: 'Override for dev/prod. Leave blank to derive it from build-ref against vars.DOCS_PROD_BRANCH - only needs setting explicitly when DOCS_DEV_BRANCH == DOCS_PROD_BRANCH, where build-ref alone cannot tell the two builds apart.'
2020
type: string
2121
required: false
2222
default: ''
2323

2424
jobs:
2525

26-
# Resolves dispatch-env (dev/prod) once, so neither docs-build nor publish-html
27-
# duplicates the override-or-derive logic. Also reusable-docs-build.yml's publish-env
28-
# input, now that both speak the same dev/prod vocabulary.
26+
# Resolves publish-env (dev/prod) once, so neither docs-build nor publish-html
27+
# duplicates the override-or-derive logic.
2928
resolve-env:
3029
name: Resolve environment
3130
runs-on: ubuntu-latest
3231
outputs:
33-
dispatch-env: ${{ steps.resolve.outputs.dispatch-env }}
32+
publish-env: ${{ steps.resolve.outputs.publish-env }}
3433
steps:
35-
- name: Resolve dispatch-env
34+
- name: Resolve publish-env
3635
id: resolve
3736
env:
38-
DISPATCH_ENV_OVERRIDE: ${{ inputs.dispatch-env }}
37+
PUBLISH_ENV_OVERRIDE: ${{ inputs.publish-env }}
3938
BUILD_REF: ${{ inputs.build-ref }}
4039
PROD_BRANCH: ${{ vars.DOCS_PROD_BRANCH }}
4140
run: |
42-
if [[ -n "${DISPATCH_ENV_OVERRIDE}" ]]; then
43-
dispatch_env="${DISPATCH_ENV_OVERRIDE}"
41+
if [[ -n "${PUBLISH_ENV_OVERRIDE}" ]]; then
42+
publish_env="${PUBLISH_ENV_OVERRIDE}"
4443
elif [[ "${BUILD_REF}" == "${PROD_BRANCH}" ]]; then
45-
dispatch_env="prod"
44+
publish_env="prod"
4645
else
47-
dispatch_env="dev"
46+
publish_env="dev"
4847
fi
4948
50-
echo "dispatch-env=${dispatch_env}" >> $GITHUB_OUTPUT
49+
echo "publish-env=${publish_env}" >> $GITHUB_OUTPUT
5150
5251
docs-build:
5352
name: Generate HTML
@@ -58,7 +57,7 @@ jobs:
5857
package-script: 'verify:publish'
5958
build-ref: ${{ inputs.build-ref }}
6059
fetch-depth: 0
61-
publish-env: ${{ needs.resolve-env.outputs.dispatch-env }}
60+
publish-env: ${{ needs.resolve-env.outputs.publish-env }}
6261

6362
docs-verify:
6463
name: Verify HTML
@@ -74,7 +73,7 @@ jobs:
7473
needs: [docs-verify, resolve-env]
7574
runs-on: ubuntu-latest
7675
steps:
77-
- name: Publish to ${{ needs.resolve-env.outputs.dispatch-env }}
76+
- name: Publish to ${{ needs.resolve-env.outputs.publish-env }}
7877
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 #v4
7978
with:
8079
token: ${{ secrets.DOCS_DISPATCH_TOKEN }}
@@ -85,5 +84,5 @@ jobs:
8584
"org": "${{ github.repository_owner }}",
8685
"repo": "${{ github.event.repository.name }}",
8786
"run_id": "${{ github.run_id }}",
88-
"publish_env": "${{ needs.resolve-env.outputs.dispatch-env }}"
87+
"publish_env": "${{ needs.resolve-env.outputs.publish-env }}"
8988
}

.github/workflows/docs-publish.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ jobs:
4545
name: Set builds to trigger
4646
runs-on: ubuntu-latest
4747
outputs:
48-
# JSON array of {buildRef, dispatchEnv} - one entry per independent
49-
# docs-generate-html.yml run to trigger. dispatchEnv is left '' except in the one
48+
# JSON array of {buildRef, publishEnv} - one entry per independent
49+
# docs-generate-html.yml run to trigger. publishEnv is left '' except in the one
5050
# case where it's genuinely ambiguous (see below) - docs-generate-html.yml derives
51-
# both dispatch-env and publish-env itself from build-ref against its own
52-
# vars.DOCS_PROD_BRANCH whenever dispatchEnv is blank.
51+
# it itself from build-ref against its own vars.DOCS_PROD_BRANCH whenever
52+
# publishEnv is blank.
5353
builds: ${{ steps.set-ref-env.outputs.builds }}
5454
steps:
5555
- name: Set builds
@@ -73,19 +73,19 @@ jobs:
7373
# know for certain doesn't affect prod.
7474
if [[ -z "${prod_branch}" ]]; then
7575
builds=$(jq -nc --arg dev "$dev_branch" \
76-
'[{buildRef:$dev,dispatchEnv:""}]')
76+
'[{buildRef:$dev,publishEnv:""}]')
7777
elif [[ "${dev_branch}" == "${prod_branch}" ]]; then
78-
# build-ref alone can't distinguish these two - same branch - so dispatchEnv
78+
# build-ref alone can't distinguish these two - same branch - so publishEnv
7979
# has to be passed explicitly here, or docs-generate-html.yml's derivation
8080
# would resolve both to the same environment.
8181
builds=$(jq -nc --arg b "$dev_branch" \
82-
'[{buildRef:$b,dispatchEnv:"dev"},{buildRef:$b,dispatchEnv:"prod"}]')
82+
'[{buildRef:$b,publishEnv:"dev"},{buildRef:$b,publishEnv:"prod"}]')
8383
elif [[ "${GITHUB_REF}" == "refs/heads/${dev_branch}" ]]; then
8484
builds=$(jq -nc --arg dev "$dev_branch" \
85-
'[{buildRef:$dev,dispatchEnv:""}]')
85+
'[{buildRef:$dev,publishEnv:""}]')
8686
else
8787
builds=$(jq -nc --arg dev "$dev_branch" --arg prod "$prod_branch" \
88-
'[{buildRef:$dev,dispatchEnv:""},{buildRef:$prod,dispatchEnv:""}]')
88+
'[{buildRef:$dev,publishEnv:""},{buildRef:$prod,publishEnv:""}]')
8989
fi
9090
9191
echo "builds=${builds}" >> $GITHUB_OUTPUT
@@ -116,7 +116,7 @@ jobs:
116116
ref: process.env.DISPATCH_REF,
117117
inputs: {
118118
'build-ref': build.buildRef,
119-
'dispatch-env': build.dispatchEnv,
119+
'publish-env': build.publishEnv,
120120
},
121121
})
122122
}

0 commit comments

Comments
 (0)