Skip to content

Commit

Permalink
Merge pull request #2 from chances/docs-github-pages
Browse files Browse the repository at this point in the history
Refactor workflow for static HTML
  • Loading branch information
chances authored Feb 26, 2024
2 parents b93c37d + c7536ea commit 5808683
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
name: Documentation

permissions:
contents: write
contents: read
pages: write
id-token: write

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
# Build docs with Ddoc
- name: Install D compiler
uses: dlang-community/setup-dlang@v1
with:
Expand All @@ -28,16 +33,22 @@ jobs:
key: ${{ runner.os }}-dub-${{ hashFiles('**/dub.json') }}
restore-keys: |
${{ runner.os }}-dub-
- name: Build Documentation
run: dub build -b docs

- name: GitHub Pages
if: success() && github.ref == 'refs/heads/main'
uses: crazy-max/ghaction-github-pages@v4
# Upload site artifact
- name: Upload Artifact
uses: actions/upload-pages-artifact@v3
with:
target_branch: gh-pages
build_dir: docs
keep_history: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
path: docs

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 5808683

Please sign in to comment.