Skip to content

Commit

Permalink
Make the action composite
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkKremer committed Oct 20, 2024
1 parent 03cfdd2 commit b9930f4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 23 deletions.
29 changes: 29 additions & 0 deletions .github/actions/docgen/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'gopxl docs'
author: 'Mark Kremer'
description: 'A static website generator for the gopxl Markdown documentation'
inputs:
site-url:
description: "URL the site will be deployed to (https://owner.github.com/project)"
required: true
github-url:
description: "URL to the Github repository"
required: true
docs-directory:
description: 'Path to the documentation directory inside the repository'
required: true
output-directory:
description: 'Directory the generated files will be put in'
required: true
main-branch:
description: 'Branch to publish alongside tagged versions'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
env:
SITE_URL: ${{ inputs.site-url }}
GITHUB_URL: ${{ inputs.github-url }}
REPOSITORY_PATH: ./
DOCS_DIR: ${{ inputs.docs-directory }}
OUTPUT_DIR: ${{ inputs.output-directory }}
MAIN_BRANCH: ${{ inputs.main-branch }}
13 changes: 2 additions & 11 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,10 @@ jobs:
OUTPUT_DIR: '_site/'
BRANCH: 'main'
steps:
- uses: actions/configure-pages@v5
id: configure-pages
- uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH }}
fetch-depth: 0 # checkout a non-shallow copy so the generator can generate docs for all major versions
- name: Checkout
uses: actions/checkout@v3
- uses: ./
with:
site-url: ${{ steps.configure-pages.outputs.base_url }}
docs-directory: ${{ env.DOCS_DIR }}
output-directory: ${{ env.OUTPUT_DIR }}
main-branch: ${{ env.BRANCH }}
- uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.OUTPUT_DIR }}
- uses: actions/deploy-pages@v4
36 changes: 24 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ name: 'gopxl docs'
author: 'Mark Kremer'
description: 'A static website generator for the gopxl Markdown documentation'
inputs:
site-url:
description: "URL the site will be deployed to (https://owner.github.com/project)"
required: true
github-url:
description: "URL to the Github repository"
default: ${{ github.server_url }}/${{ github.repository }}
Expand All @@ -20,12 +17,27 @@ inputs:
description: 'Branch to publish alongside tagged versions'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
env:
SITE_URL: ${{ inputs.site-url }}
GITHUB_URL: ${{ inputs.github-url }}
REPOSITORY_PATH: ./
DOCS_DIR: ${{ inputs.docs-directory }}
OUTPUT_DIR: ${{ inputs.output-directory }}
MAIN_BRANCH: ${{ inputs.main-branch }}
using: 'composite'
steps:
- name: Configure pages
uses: actions/configure-pages@v5
id: configure-pages
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ inputs.main-branch }}
fetch-depth: 0 # checkout a non-shallow copy so the generator can generate docs for all major versions
- name: Generate static site
uses: ./.github/actions/docgen
with:
site-url: ${{ steps.configure-pages.outputs.base_url }}
github-url: ${{ inputs.github-url }}
docs-directory: ${{ inputs.docs-directory }}
output-directory: ${{ inputs.output-directory }}
main-branch: ${{ inputs.main-branch }}
- name: Upload pages
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.OUTPUT_DIR }}
- name: Deploy pages
uses: actions/deploy-pages@v4

0 comments on commit b9930f4

Please sign in to comment.