Skip to content

Commit

Permalink
Add workflow for deploying website after updating the documentation (#…
Browse files Browse the repository at this point in the history
…239)

This will allow the website to automatically get updated when we update
the doc repository. I setup a repository action on the website github,
which allows incoming events to trigger the build and deploy action.

Some notes about security. The credential being used has write
permission the website repository, so to compensate I locked down all
the branches to require PRs, which should prevent any malicious
attackers if they get access to the credentials. The downside is no more
directly pushing to the website, which I think is an OK tradeoff.

This PR is dependent on this PR getting merged first:
valkey-io/valkey-io.github.io#214.


Some other things I investigated:
1. [Re-usable
workflows](https://docs.github.com/en/actions/sharing-automations/reusing-workflows):
I wasn't able to get the deploy functionality to have permissions across
repository, these seem to only work correctly within the same
repository.
2. Triggering the website build from this repo. This required
duplicating the build and deploy steps. This seemed like a cleaner
approach.

Signed-off-by: Madelyn Olson <[email protected]>
  • Loading branch information
madolson authored Feb 27, 2025
1 parent 6355d85 commit fa4cdbf
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/trigger-build.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: Trigger master website deploy
name: Trigger website deploy
on:
push:
branches:
- master
- main

jobs:
trigger:
deploy:
runs-on: ubuntu-latest
steps:
- run: |
echo "'$DATA'" | xargs \
curl \
-X POST https://api.netlify.com/build_hooks/${NETLIFY_BUILD_HOOK_ID} \
-d
env:
NETLIFY_BUILD_HOOK_ID: ${{ secrets.NETLIFY_BUILD_HOOK_ID }}
DATA: '{"type": "core", "id": "redis_docs", "repository":"${{ github.repository }}", "sha":"${{ github.sha }}", "ref":"${{ github.ref }}"}}'
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ secrets.DEPLOY_ACCESS_TOKEN }}
repository: valkey-io/valkey-io.github.io
event-type: deploy

0 comments on commit fa4cdbf

Please sign in to comment.