Skip to content

Commit

Permalink
ci: Switch to GH Actions for CloudFlare Preview (#359)
Browse files Browse the repository at this point in the history
## Description:
<!-- Describe this change, how it works, and the motivation behind it.
-->
Building docs at each PR is time consuming. This PR migrates away from
CloudFlare owned automation to a Kurtosis-managed GitHub Action to build
and publish docs.

With that, we can skip build and push if no docs were changed.

## Is this change user facing?
NO
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
  • Loading branch information
victorcolombo committed Mar 29, 2023
1 parent c80d3c0 commit 88a9bba
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/push-docs.yml
@@ -1,10 +1,6 @@
name: Deploy documentation


on:
push:
branches:
- 'main'
on: push

jobs:
publish:
Expand All @@ -16,20 +12,28 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

with:
fetch-depth: 0
- name: Docs have changed
run: |
echo "DOCS_CHANGED=$(git --no-pager diff --exit-code origin/main...HEAD -- ':docs' > /dev/null; echo $?)" >> $GITHUB_OUTPUT
id: docs-diff
- name: Append changelog
run: cat CHANGELOG.md >> docs/docs/changelog.md
if: github.ref == 'refs/heads/main' || steps.docs-diff.outputs.DOCS_CHANGED != 0
- name: Yarn Install
run: yarn --cwd ./docs install
if: github.ref == 'refs/heads/main' || steps.docs-diff.outputs.DOCS_CHANGED != 0
- name: Yarn Build
run: yarn --cwd ./docs build

if: github.ref == 'refs/heads/main' || steps.docs-diff.outputs.DOCS_CHANGED != 0
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: github.ref == 'refs/heads/main' || steps.docs-diff.outputs.DOCS_CHANGED != 0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: docs/build/
# as we publish on tag we want to tell CF that the branch is still main so that it can deploy to production
branch: main
branch: ${GITHUB_REF##*/}

0 comments on commit 88a9bba

Please sign in to comment.