Skip to content

Commit

Permalink
deploy wiki previews to cf pages
Browse files Browse the repository at this point in the history
  • Loading branch information
topi314 committed Aug 15, 2023
1 parent abf21fc commit 09795b6
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: docs

on:
push:
branches:
- master
- docs # for testing
branches: [ '**' ]
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
Expand All @@ -22,6 +20,7 @@ concurrency:

jobs:
deploy:
if: github.ref == 'refs/heads/docs'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand All @@ -47,3 +46,36 @@ jobs:
path: 'site'
- id: deployment
uses: actions/deploy-pages@v1

deploy-preview:
if: github.ref != 'refs/heads/docs'
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs build --verbose --strict
- uses: actions/upload-pages-artifact@v1
with:
path: 'site'
- uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ github.repository }}
directory: site
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 09795b6

Please sign in to comment.