├── .github └── workflows │ └── ci.yml ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml ├── docs ├── ignore.html └── index.html ├── entrypoint.sh └── images └── Personal_Access_Tokens.png /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Deploy the static file to GitHub Page 2 | on: [push] 3 | jobs: 4 | 5 | build: 6 | name: Build 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: checkout 10 | uses: actions/checkout@v1 11 | 12 | - name: deploy docs 13 | uses: ./ 14 | with: 15 | username: ${{ secrets.USERNAME }} 16 | password: ${{ secrets.PASSWORD }} 17 | remote_url: https://github.com/appleboy/gh-pages-action.git 18 | 19 | - name: deploy to target directory 20 | uses: ./ 21 | with: 22 | username: ${{ secrets.USERNAME }} 23 | password: ${{ secrets.PASSWORD }} 24 | remote_url: https://github.com/appleboy/gh-pages-action.git 25 | target_directory: 2020 26 | 27 | - name: exclude list 28 | uses: ./ 29 | with: 30 | username: ${{ secrets.USERNAME }} 31 | password: ${{ secrets.PASSWORD }} 32 | remote_url: https://github.com/appleboy/gh-pages-action.git 33 | commit_author: Bo-Yi Wu 34 | commit_author_email: appleboy.tw@gmail.com 35 | target_directory: ignore 36 | exclude: ignore.html 37 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM appleboy/gh-pages:1.2.1-linux-amd64 2 | 3 | COPY entrypoint.sh /entrypoint.sh 4 | RUN chmod +x /entrypoint.sh 5 | ENTRYPOINT ["/entrypoint.sh"] 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Bo-Yi Wu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🚀 GitHub Pages for GitHub Actions 2 | 3 | [GitHub Action](https://github.com/features/actions) for deploying a static site on GitHub Pages. 4 | 5 |  6 | 7 | ## Usage 8 | 9 | Deploying a static site on GitHub Pages. 10 | 11 | ```yaml 12 | name: Deploy the static file to GitHub Page 13 | on: [push] 14 | jobs: 15 | 16 | build: 17 | name: Build 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: checkout 21 | uses: actions/checkout@v1 22 | 23 | - name: deploy docs 24 | uses: ./ 25 | with: 26 | username: ${{ secrets.USERNAME }} 27 | password: ${{ secrets.PASSWORD }} 28 | remote_url: https://github.com/appleboy/gh-pages-action.git 29 | ``` 30 | 31 | Please create your own [Personal Access Token](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) on GitHub setting page and set the password as access token not your account password. 32 | 33 |  34 | 35 | output: 36 | 37 | ```sh 38 | D Dockerfile 39 | D LICENSE 40 | D README.md 41 | D action.yml 42 | D docs/index.html 43 | D entrypoint.sh 44 | ?? index.html 45 | + git add . 46 | + git commit -m commit 6b0497a3b6f0f975c605c28950dbe15dedf4e8f0 47 | Author: Bo-Yi Wu <***.tw@gmail.com> 48 | Date: Sat Mar 7 20:25:50 2020 +0800 49 | 50 | chore: update 51 | 52 | [gh-pages f156e8c] commit 6b0497a3b6f0f975c605c28950dbe15dedf4e8f0 Author: Bo-Yi Wu <***.tw@gmail.com> Date: Sat Mar 7 20:25:50 2020 +0800 53 | 7 files changed, 94 deletions(-) 54 | delete mode 100644 .github/workflows/ci.yml 55 | delete mode 100644 Dockerfile 56 | delete mode 100644 LICENSE 57 | delete mode 100644 README.md 58 | delete mode 100644 action.yml 59 | delete mode 100755 entrypoint.sh 60 | rename docs/index.html => index.html (100%) 61 | + git push origin HEAD:gh-pages 62 | To https://github.com/***/gh-pages-action.git 63 | bd265c2..f156e8c HEAD -> gh-pages 64 | ``` 65 | 66 | ## Input variables 67 | 68 | See [action.yml](./action.yml) for more detailed information. 69 | 70 | * username - github username 71 | * password - github password or [create your personal access token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) 72 | * upstream_name - git upstream to target, default is `origin` 73 | * target_branch - git branch to target, default is `gh-pages` 74 | * temporary_base - temporary directory for pages pull, default is `.tmp` 75 | * pages_directory - directory of content to publish, default is `docs` 76 | * target_directory - directory of content to sync 77 | * exclude - exclude files matching PATTERN 78 | * commit_author - git author name, default is `GitHub Action` 79 | * commit_author_email - git author email, default is `github-action@users.noreply.github.com` 80 | * remote_url - git remote url 81 | * workspace - git clone path 82 | 83 | ### Example 84 | 85 | Deploy to target directory. 86 | 87 | ```yaml 88 | - name: deploy to target directory 89 | uses: ./ 90 | with: 91 | username: ${{ secrets.USERNAME }} 92 | password: ${{ secrets.PASSWORD }} 93 | remote_url: https://github.com/appleboy/gh-pages-action.git 94 | target_directory: 2020 95 | ``` 96 | 97 | Custom ignore list you don't want to sync. 98 | 99 | ```yaml 100 | - name: exclude list 101 | uses: ./ 102 | with: 103 | username: ${{ secrets.USERNAME }} 104 | password: ${{ secrets.PASSWORD }} 105 | remote_url: https://github.com/appleboy/gh-pages-action.git 106 | target_directory: ignore 107 | exclude: ignore.html 108 | ``` 109 | 110 | custom author email and name: 111 | 112 | ```yaml 113 | - name: deploy to target directory 114 | uses: ./ 115 | with: 116 | username: ${{ secrets.USERNAME }} 117 | password: ${{ secrets.PASSWORD }} 118 | remote_url: https://github.com/appleboy/gh-pages-action.git 119 | commit_author: foo 120 | commit_author_email: bar@foobar.com 121 | target_directory: 2020 122 | ``` 123 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'GitHub Pages Deploy' 2 | description: 'Deploy the static file to GitHub Page' 3 | author: 'Bo-Yi Wu' 4 | inputs: 5 | username: 6 | description: 'username' 7 | password: 8 | description: 'password' 9 | upstream_name: 10 | description: 'git upstream to target' 11 | default: 'origin' 12 | target_branch: 13 | description: 'git branch to target' 14 | default: 'gh-pages' 15 | temporary_base: 16 | description: 'temporary directory for pages pull' 17 | default: '.tmp' 18 | pages_directory: 19 | description: 'directory of content to publish' 20 | default: 'docs' 21 | target_directory: 22 | description: 'directory of content to sync' 23 | exclude: 24 | description: 'exclude files matching PATTERN' 25 | commit_author: 26 | description: 'git author name' 27 | default: 'GitHub Action' 28 | commit_author_email: 29 | description: 'git author email' 30 | default: 'github-action@users.noreply.github.com' 31 | remote_url: 32 | description: 'git remote url' 33 | workspace: 34 | description: 'git clone path' 35 | runs: 36 | using: 'docker' 37 | image: 'Dockerfile' 38 | 39 | branding: 40 | icon: 'cloud' 41 | color: 'gray-dark' 42 | -------------------------------------------------------------------------------- /docs/ignore.html: -------------------------------------------------------------------------------- 1 | test 2 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |This is an example paragraph. Anything in the body tag will appear on the page, just like this p tag and its contents.
8 |See the gh-pages plugin
9 | 10 | 11 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | INPUT_COMMIT_AUTHOR_EMAIL=${INPUT_COMMIT_AUTHOR_EMAIL:-'github-action@users.noreply.github.com'} 6 | INPUT_COMMIT_AUTHOR=${INPUT_COMMIT_AUTHOR:-'GitHub Action'} 7 | 8 | sh -c "/bin/drone-gh-pages" 9 | -------------------------------------------------------------------------------- /images/Personal_Access_Tokens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/appleboy/gh-pages-action/d3d9541b0e8917bd93da785ec6fb1c63f265e185/images/Personal_Access_Tokens.png --------------------------------------------------------------------------------