Skip to content

Commit 24a8a34

Browse files
Set deploy key secrets by name
1 parent ce38646 commit 24a8a34

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎.github/workflows/promote.yml‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,16 @@ jobs:
4848
group: promote-${{ matrix.site }}
4949
cancel-in-progress: false
5050
steps:
51-
- name: Pick deploy key
52-
id: key
53-
env:
54-
SITE: ${{ matrix.site }}
55-
run: echo "name=DEPLOY_KEY_${SITE^^}" >> "$GITHUB_OUTPUT"
56-
51+
# Secrets are named statically so the runner only receives the deploy keys.
5752
- name: Check deploy key
5853
env:
59-
KEY: ${{ secrets[steps.key.outputs.name] }}
60-
NAME: ${{ steps.key.outputs.name }}
54+
KEY: ${{ matrix.site == 'xnat' && secrets.DEPLOY_KEY_XNAT || matrix.site == 'pitschi' && secrets.DEPLOY_KEY_PITSCHI || matrix.site == 'hpc' && secrets.DEPLOY_KEY_HPC || '' }}
55+
SITE: ${{ matrix.site }}
6156
REPO: UQ-RCC/docs.${{ matrix.site }}.rcc.uq.edu.au
6257
run: |
6358
if [ -z "$KEY" ]; then
64-
echo "::error title=Missing deploy key::Secret $NAME is not set. Add the public key to $REPO under Settings > Deploy keys with write access, and the private key to ${{ github.repository }} as Actions secret $NAME."
59+
name="DEPLOY_KEY_${SITE^^}"
60+
echo "::error title=Missing deploy key::Secret $name is not set. Add the public key to $REPO under Settings > Deploy keys with write access, and the private key to ${{ github.repository }} as Actions secret $name."
6561
exit 1
6662
fi
6763
@@ -90,7 +86,7 @@ jobs:
9086
- name: Deploy
9187
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
9288
with:
93-
deploy_key: ${{ secrets[steps.key.outputs.name] }}
89+
deploy_key: ${{ matrix.site == 'xnat' && secrets.DEPLOY_KEY_XNAT || matrix.site == 'pitschi' && secrets.DEPLOY_KEY_PITSCHI || matrix.site == 'hpc' && secrets.DEPLOY_KEY_HPC || '' }}
9490
external_repository: UQ-RCC/docs.${{ matrix.site }}.rcc.uq.edu.au
9591
publish_branch: gh-pages
9692
publish_dir: ./sites/${{ matrix.site }}/dist

0 commit comments

Comments
 (0)