From 1db16b8965eef69806ec2cd76c40d63b880a4cb2 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Thu, 24 Oct 2024 19:11:59 +0200 Subject: [PATCH] Revert make action composite --- .github/actions/docgen/action.yml | 29 ------------- .github/workflows/github-pages.yml | 20 +++++++-- action.yml | 43 ++++++-------------- docs/01. Getting Started/01. Installation.md | 20 ++++++++- 4 files changed, 47 insertions(+), 65 deletions(-) delete mode 100644 .github/actions/docgen/action.yml diff --git a/.github/actions/docgen/action.yml b/.github/actions/docgen/action.yml deleted file mode 100644 index 2f06d26..0000000 --- a/.github/actions/docgen/action.yml +++ /dev/null @@ -1,29 +0,0 @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index c65ae3a..228e4e5 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -6,7 +6,6 @@ on: branches: ['main'] jobs: - upload-docs: runs-on: ubuntu-latest permissions: @@ -14,11 +13,26 @@ jobs: id-token: write env: DOCS_DIR: 'docs/' - BRANCH: 'main' + OUTPUT_DIR: '_site/' + MAIN_BRANCH: 'main' steps: + - name: Configure pages + uses: actions/configure-pages@v5 + id: configure-pages - name: Checkout uses: actions/checkout@v3 + with: + ref: ${{ env.MAIN_BRANCH }} + fetch-depth: 0 # checkout a non-shallow copy so the generator can generate docs for all major versions - uses: ./ with: + site-url: ${{ steps.configure-pages.outputs.base_url }} docs-directory: ${{ env.DOCS_DIR }} - main-branch: ${{ env.BRANCH }} + output-directory: ${{ env.OUTPUT_DIR }} + main-branch: ${{ env.MAIN_BRANCH }} + - name: Upload pages + uses: actions/upload-pages-artifact@v3 + with: + path: ${{ env.OUTPUT_DIR }} + - name: Deploy pages + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/action.yml b/action.yml index 8afef41..8dfd2b5 100644 --- a/action.yml +++ b/action.yml @@ -2,6 +2,9 @@ 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 }} @@ -16,35 +19,13 @@ inputs: main-branch: description: 'Branch to publish alongside tagged versions' required: true - # temporary, figure out another solution. - action-repository: - description: "for internal use" - default: ${{ github.action_repository }} - action-ref: - description: "for internal use" - default: ${{ github.action_ref }} runs: - 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: ${{ inputs.action-repository }}/.github/actions/docgen@${{ inputs.action-ref }} - 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: ${{ inputs.output-directory }} - - name: Deploy pages - uses: actions/deploy-pages@v4 + 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 }} diff --git a/docs/01. Getting Started/01. Installation.md b/docs/01. Getting Started/01. Installation.md index 4011f0c..ee06b7a 100644 --- a/docs/01. Getting Started/01. Installation.md +++ b/docs/01. Getting Started/01. Installation.md @@ -24,10 +24,26 @@ jobs: pages: write id-token: write steps: + - name: Configure pages + uses: actions/configure-pages@v5 + id: configure-pages + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ env.MAIN_BRANCH }} + fetch-depth: 0 # checkout a non-shallow copy so the generator can generate docs for all major versions - uses: gopxl/docs@main with: - docs-directory: 'docs/' - main-branch: 'main' + site-url: ${{ steps.configure-pages.outputs.base_url }} + docs-directory: ${{ env.DOCS_DIR }} + output-directory: ${{ env.OUTPUT_DIR }} + main-branch: ${{ env.MAIN_BRANCH }} + - name: Upload pages + uses: actions/upload-pages-artifact@v3 + with: + path: ${{ env.OUTPUT_DIR }} + - name: Deploy pages + uses: actions/deploy-pages@v4 ``` ## Linking the site from the GitHub repository