peaceiris / actions-gh-pages

GitHub Actions for GitHub Pages 🚀 Deploy static files and publish your site easily. Static-Site-Generators-friendly.
https://github.com/marketplace/actions/github-pages-action
MIT License
4.72k stars 374 forks source link

proposal: output working directory #1086

Open Falco20019 opened 3 months ago

Falco20019 commented 3 months ago

Checklist

Describe your proposal

It would be great to export the working directory as action output to be used in follow-up actions. Right now, I use the following to update a part of the specification and publish it using actions/deploy-pages:

name: Deploy - TechSpec

on:
  workflow_call:
    inputs:
      artifact-name:
        type: string
        required: true
        description: "Name of the artifact that contains the files to deploy."
      tech-spec-folder:
        type: string
        required: true
        description: "The name of the subfolder to use (defined by the version)."
    secrets:
      ACTION_PAT:
        required: true

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
  group: techspec_${{ github.repository }}
  cancel-in-progress: false

jobs:
  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}

    runs-on: ubuntu-latest

    steps:
      - name: Download package
        uses: actions/download-artifact@v4
        with:
            name: ${{ inputs.artifact-name }}
            path: artifact
      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        with:
          personal_token: ${{ secrets.ACTION_PAT }}
          publish_dir: artifact
          destination_dir: ${{ inputs.tech-spec-folder }}
      - name: Setup Pages
        uses: actions/configure-pages@v5
        with:
          enablement: true
          token: ${{ secrets.ACTION_PAT }}
      - name: Checkout gh-pages
        uses: actions/checkout@v4
        with:
          token: ${{ secrets.ACTION_PAT }}
          ref: gh-pages
          path: _site
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4
        with:
          token: ${{ secrets.ACTION_PAT }}

Describe the solution you'd like

If peaceiris/actions-gh-pages would export the working directory, it would not be necessry to checkout the gh-pages branch again, since it's already on the runner. Instead, I could just pass the path to actions/upload-pages-artifact directly.

Describe alternatives you've considered

No response

Additional context

It seems, that this action is assuming that the legacy model of using branches is configured for triggering the publish. But since GitHub marked it as legacy, we would prefer to use the GitHub Actions workflow proposed by them instead in combination with having