Skip to content

Commit

Permalink
Docs workflow fixes. (#1030)
Browse files Browse the repository at this point in the history
- add write permission
- use tag name (v prefix)
- require environment.
- fetch docs-pages branch
- explicitly set branch for mike
  • Loading branch information
jamesmunro committed Nov 4, 2023
1 parent bd078ff commit f47b7cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/docs_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ on:
jobs:
docs_build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{inputs.version || 'master'}}
ref: ${{inputs.version && format('v{0}', inputs.version) || 'master'}}

- name: Fetch docs-pages branch
if: ${{inputs.deploy}}
run: git fetch origin docs-pages --depth=1

- name: Detect runner Python implementation
if: ${{!inputs.version}}
Expand Down Expand Up @@ -60,8 +66,8 @@ jobs:
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git_hash=$(git rev-parse --short HEAD)
mike deploy ${{inputs.version || 'dev'}} ${{inputs.latest && 'latest' || ''}} --update-aliases ${{inputs.deploy && '--push' || ''}} --message "Deploying docs: ${{inputs.version || 'dev'}} $git_hash ${{inputs.latest && '[latest]' || ''}}"
mike set-default latest
mike deploy ${{inputs.version || 'dev'}} ${{inputs.latest && 'latest' || ''}} --update-aliases --branch docs-pages ${{inputs.deploy && '--push' || ''}} --message "Deploying docs: ${{inputs.version || 'dev'}} $git_hash ${{inputs.latest && '[latest]' || ''}}"
mike set-default latest --branch docs-pages ${{inputs.deploy && '--push' || ''}}
- name: List docs versions after deploy
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docs Publish
on:
workflow_dispatch:
inputs:
environment: { type: environment, required: false }
environment: { type: environment, required: true }
jobs:
docs_publish:
runs-on: ubuntu-latest
Expand All @@ -20,4 +20,5 @@ jobs:
apiToken: ${{secrets.CLOUDFLARE_API_TOKEN}}
accountId: ${{vars.CLOUDFLARE_ACCOUNT_ID}}
projectName: ${{vars.CLOUDFLARE_PAGES_PROJECT}}
directory: .
branch: ${{vars.CLOUDFLARE_PAGE_BRANCH}}

0 comments on commit f47b7cd

Please sign in to comment.