Skip to content

A GitHub Action to deploy a static site on GitHub Pages.

License

Notifications You must be signed in to change notification settings

appleboy/gh-pages-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 GitHub Pages for GitHub Actions

GitHub Action for deploying a static site on GitHub Pages.

Deploy the static file to GitHub Page

Usage

Deploying a static site on GitHub Pages.

name: Deploy the static file to GitHub Page
on: [push]
jobs:

  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
    - name: checkout
      uses: actions/checkout@v1

    - name: deploy docs
      uses: ./
      with:
        username: ${{ secrets.USERNAME }}
        password: ${{ secrets.PASSWORD }}
        remote_url: https://github.com/appleboy/gh-pages-action.git

Please create your own Personal Access Token on GitHub setting page and set the password as access token not your account password.

token

output:

 D Dockerfile
 D LICENSE
 D README.md
 D action.yml
 D docs/index.html
 D entrypoint.sh
?? index.html
+ git add .
+ git commit -m commit 6b0497a3b6f0f975c605c28950dbe15dedf4e8f0
Author: Bo-Yi Wu <***[email protected]>
Date:   Sat Mar 7 20:25:50 2020 +0800

    chore: update

[gh-pages f156e8c] commit 6b0497a3b6f0f975c605c28950dbe15dedf4e8f0 Author: Bo-Yi Wu <***[email protected]> Date:   Sat Mar 7 20:25:50 2020 +0800
 7 files changed, 94 deletions(-)
 delete mode 100644 .github/workflows/ci.yml
 delete mode 100644 Dockerfile
 delete mode 100644 LICENSE
 delete mode 100644 README.md
 delete mode 100644 action.yml
 delete mode 100755 entrypoint.sh
 rename docs/index.html => index.html (100%)
+ git push origin HEAD:gh-pages
To https://github.com/***/gh-pages-action.git
   bd265c2..f156e8c  HEAD -> gh-pages

Input variables

See action.yml for more detailed information.

  • username - github username
  • password - github password or create your personal access token
  • upstream_name - git upstream to target, default is origin
  • target_branch - git branch to target, default is gh-pages
  • temporary_base - temporary directory for pages pull, default is .tmp
  • pages_directory - directory of content to publish, default is docs
  • target_directory - directory of content to sync
  • exclude - exclude files matching PATTERN
  • commit_author - git author name, default is GitHub Action
  • commit_author_email - git author email, default is [email protected]
  • remote_url - git remote url
  • workspace - git clone path

Example

Deploy to target directory.

- name: deploy to target directory
  uses: ./
  with:
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}
    remote_url: https://github.com/appleboy/gh-pages-action.git
    target_directory: 2020

Custom ignore list you don't want to sync.

- name: exclude list
  uses: ./
  with:
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}
    remote_url: https://github.com/appleboy/gh-pages-action.git
    target_directory: ignore
    exclude: ignore.html

custom author email and name:

- name: deploy to target directory
  uses: ./
  with:
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}
    remote_url: https://github.com/appleboy/gh-pages-action.git
    commit_author: foo
    commit_author_email: [email protected]
    target_directory: 2020