push-dir

Cleanly push directory contents to a branch

OTHER License

Stars
4

GitHub Action: Push Directory

Cleanly push directory contents to a branch. Particularly useful for gh-pages deployment.

Example

    steps:
      - uses: actions/checkout@v3
      - run: build_site_command --output-dir static_site
      - uses: casperdcl/push-dir@v1
        with:
          message: update static site
          branch: gh-pages
          dir: static_site
          history: false
          cname: my.domain.com
          nojekyll: true

Why

Perfect for e.g. gh-pages deployment.

  • Supports pushing the contents of a directory to a branch
  • Supports discarding branch history
  • Uses a blazing fast native GitHub composite action
  • Has the entirety of the code in a single file, making it very easy to review

The main alternatives GitHub Actions gh-pages-deploy and github-push currently do not offer the benefits above.

Other features (supported by some of the alternatives) include:

  • Custom committer name & email
  • Custom commit message
  • Force pushing
  • CNAME & .nojekyll conveniences for GitHub pages

Inputs

message:
  description: Commit message
  required: true
branch:
  description: Branch to push to
  required: true
dir:
  description: Directory to push
  default: .
  required: false
force:
  description: Set to "true" to force push
  required: false
history:
  description: |
    Set to "false" to discard any prior commits on the `branch`
    (Note: "false" will override `force` to "true")
  default: true
  required: false
cname:
  description: Text to inject into a `CNAME` file
  default: ''
  required: false
nojekyll:
  description: Set to "true" to add a `.nojekyll` file
  required: false
name:
  description: Git committer name
  required: false
email:
  description: Git committer email
  required: false
Package Rankings
Top 13.12% on Github actions
Badges
Extracted from project README
Test
Related Projects