diff --git a/Dockerfile b/.github/actions/docgen/Dockerfile similarity index 95% rename from Dockerfile rename to .github/actions/docgen/Dockerfile index dfc5785..0bf7d7d 100644 --- a/Dockerfile +++ b/.github/actions/docgen/Dockerfile @@ -9,7 +9,7 @@ COPY --from=node /usr/local/bin /usr/local/bin WORKDIR /app -COPY ./ ./ +COPY ../../../ ./ RUN npm install RUN npm run build diff --git a/.github/actions/docgen/action.yml b/.github/actions/docgen/action.yml new file mode 100644 index 0000000..df46f5b --- /dev/null +++ b/.github/actions/docgen/action.yml @@ -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 }} \ No newline at end of file diff --git a/entrypoint.sh b/.github/actions/docgen/entrypoint.sh similarity index 100% rename from entrypoint.sh rename to .github/actions/docgen/entrypoint.sh diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index 6947969..0fc00a3 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -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 diff --git a/action.yml b/action.yml index 8dfd2b5..096e89c 100644 --- a/action.yml +++ b/action.yml @@ -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 }} @@ -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