Compare commits

..

14 Commits

Author SHA1 Message Date
peaceiris
b6a9b4b75a Merge branch 'master' into force-orphan 2019-10-17 16:38:24 +09:00
peaceiris
69067de181 docs: Remove the link to actions tab
We need to login to access the actions tab.

https://github.com/sdras/awesome-actions/issues/232
2019-10-17 16:36:44 +09:00
peaceiris
a0131c39a3 enhance: forceOrphan condition check 2019-10-17 08:53:02 +09:00
peaceiris
a899cb542b fix: Force push when forceOrphan is true 2019-10-17 07:51:48 +09:00
peaceiris
f83fbff9f3 fix: forceOrphan condition check 2019-10-17 07:46:50 +09:00
peaceiris
7216888f95 feat: Add INPUT_FORCEORPHAN, close #42 2019-10-17 07:41:16 +09:00
peaceiris
7f7794a793 docs: update Hugo workflow example, enhance build step 2019-10-14 22:03:59 +09:00
peaceiris
e60d374041 docs: Enhance node-version 2019-10-08 18:59:10 +09:00
imgbot[bot]
8191f265b1 [ImgBot] Optimize images (#40)
/images/ogp.svg -- 45.84kb -> 45.82kb (0.05%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2019-10-08 14:00:13 +09:00
peaceiris
4eb9565412 docs: update 2019-10-07 03:20:07 +09:00
peaceiris
e5910bfc4f docs: update tag 2019-10-07 00:21:11 +09:00
peaceiris
09158e35aa docs: Fix tag 2019-10-07 00:01:25 +09:00
peaceiris
26405de510 docs: update latest tag 2019-10-07 00:00:09 +09:00
Shohei Ueda
855ba06744 Release: v2.5.0 (#38)
* gha: enhance trigger
* feat: Add SCRIPT_MODE
* docs: Update about GITHUB_TOKEN
* docs: Add new section about Script mode, close #37
2019-10-06 23:53:36 +09:00
4 changed files with 42 additions and 42 deletions

View File

@@ -1,7 +1,7 @@
[![license](https://img.shields.io/github/license/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/blob/master/LICENSE)
[![release](https://img.shields.io/github/release/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases/latest)
[![GitHub release date](https://img.shields.io/github/release-date/peaceiris/actions-gh-pages.svg)](https://github.com/peaceiris/actions-gh-pages/releases)
[![GitHub Actions status](https://github.com/peaceiris/actions-gh-pages/workflows/docker%20image%20ci/badge.svg)](https://github.com/peaceiris/actions-gh-pages/actions)
![GitHub Actions status](https://github.com/peaceiris/actions-gh-pages/workflows/docker%20image%20ci/badge.svg)
[![Docker Hub Build Status](https://img.shields.io/docker/cloud/build/peaceiris/gh-pages.svg)](https://hub.docker.com/r/peaceiris/gh-pages)
<img width="400" alt="GitHub Actions for deploying to GitHub Pages with Static Site Generators" src="./images/ogp.svg">
@@ -17,7 +17,7 @@ This deploy action can be combined simply and freely with [Static Site Generator
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -122,15 +122,15 @@ jobs:
# submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.2.1
uses: peaceiris/actions-hugo@v2.2.2
with:
hugo-version: '0.58.3'
- name: Build
run: hugo --gc --minify --cleanDestinationDir
run: hugo --gc --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -180,8 +180,8 @@ You can pull a public docker image from Docker Hub.
By pulling docker images, you can reduce the overall execution time of your workflow. In addition, `latest` tag is provided.
```diff
- uses: peaceiris/actions-gh-pages@v2.4.0
+ uses: docker://peaceiris/gh-pages:v2.4.0
- uses: peaceiris/actions-gh-pages@v2.5.0
+ uses: docker://peaceiris/gh-pages:v2.5.0
```
- [peaceiris/gh-pages - Docker Hub](https://hub.docker.com/r/peaceiris/gh-pages)
@@ -218,7 +218,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -235,7 +235,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -254,11 +254,11 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0-rc0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
EXTERNAL_REPOSITORY: username/external-repository
PUBLISH_BRANCH: master
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
```
@@ -272,12 +272,16 @@ Be careful, `GITHUB_TOKEN` has no permission to access to external repositories.
From `v2.5.0`, we can run this action as a shell script.
There is no Docker build or pull step, so it will start immediately.
- `ACTIONS_DEPLOY_KEY` requires `SCRIPT_MODE: true`
- `*_TOKEN` do not require `SCRIPT_MODE`
```yaml
- name: Deploy
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
SCRIPT_MODE: true
run: |
wget https://raw.githubusercontent.com/peaceiris/actions-gh-pages/v2.5.0/entrypoint.sh
bash ./entrypoint.sh
@@ -378,13 +382,13 @@ jobs:
- name: build
uses: actions/setup-node@v1
with:
node-version: '10.16'
node-version: '10.x'
- run: |
npm install
npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -417,7 +421,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '10.16'
node-version: '10.x'
- name: install
run: npm install
@@ -432,7 +436,7 @@ jobs:
run: npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -467,7 +471,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '10.16'
node-version: '10.x'
- name: install
run: yarn install
@@ -482,7 +486,7 @@ jobs:
run: touch ./out/.nojekyll
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -517,7 +521,7 @@ jobs:
- name: setup node
uses: actions/setup-node@v1
with:
node-version: '10.16'
node-version: '10.x'
- name: install
run: npm install
@@ -529,7 +533,7 @@ jobs:
run: npm run generate
- name: deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -577,7 +581,7 @@ jobs:
run: mkdocs build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.4.0
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages

View File

@@ -16,3 +16,7 @@ inputs:
description: 'If existing files in the publish branch should be not removed before deploying'
required: false
default: 'false'
forceOrphan:
description: 'Keep only the latest commit on a GitHub Pages branch'
required: false
default: 'false'

View File

@@ -77,7 +77,13 @@ fi
remote_branch="${PUBLISH_BRANCH}"
local_dir="${HOME}/ghpages_${RANDOM}"
if git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
if [[ "${INPUT_FORCEORPHAN}" == "true" ]]; then
print_info "force ophan: ${INPUT_FORCEORPHAN}"
cd "${PUBLISH_DIR}"
git init
git checkout --orphan "${remote_branch}"
elif git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_repo}" "${local_dir}"; then
cd "${local_dir}"
if [[ ${INPUT_KEEPFILES} == "true" ]]; then
@@ -110,5 +116,10 @@ else
git commit --allow-empty -m "${COMMIT_MESSAGE}"
fi
git push origin "${remote_branch}"
if [[ ${INPUT_FORCEORPHAN} == "true" ]]; then
git push origin --force "${remote_branch}"
else
git push origin "${remote_branch}"
fi
print_info "${GITHUB_SHA} was successfully deployed"

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB