Compare commits

...

61 Commits

Author SHA1 Message Date
peaceiris
ee5987d184 feat: Add tagOverwrite option 2020-01-13 09:01:05 +09:00
peaceiris
0f98ab44f5 feat: Add print_info for tag options 2020-01-13 00:53:19 +09:00
peaceiris
58f69047b6 feat: Add tagName and tagMessage options
Close #76
2020-01-13 00:34:43 +09:00
VladimirLogachev
c77e021886 docs: Add elm example workflow (#65)
* Add elm section to README.md
2020-01-12 21:56:01 +09:00
peaceiris
37729f1bb3 docs: Use head_commit instead of commits[0] 2020-01-07 00:20:56 +09:00
Shohei Ueda
76351d52b8 feat: Add commitMessage option (#75)
* feat: Add commitMessage option
* docs: Add custom commit message option

Close #74
cf. #72 and #73
2020-01-06 23:46:48 +09:00
Shohei Ueda
fd02997068 fix: link to commit hash for external deployment (#73)
cf. #72
2020-01-06 23:10:35 +09:00
dependabot-preview[bot]
127155c640 deps: bump alpine from 3.11.0 to 3.11.2 (#71)
Bumps alpine from 3.11.0 to 3.11.2.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-31 11:07:02 +09:00
Shohei Ueda
0252bbee4d feat: Add username and useremail options (#67)
* feat: Add username and useremail options
* docs: Add Git username and email section

Close #66
2019-12-24 15:22:01 +09:00
Shohei Ueda
bdedb4ed2b feat: ignore .git and .github (#63)
* feat: ignore .git and .github

Close #57

* feat: update alpine to 3.11.0

cf. #64
2019-12-24 15:02:00 +09:00
Shohei Ueda
d772f4e8eb docs: pin v2 2019-12-23 06:06:47 +09:00
peaceiris
bca5701620 docs: update toc 2019-12-23 06:03:42 +09:00
peaceiris
b8c0499d1e chore: Add workflow 2019-12-23 05:51:44 +09:00
Shohei Ueda
1e0de0fccd feat: Add INPUT_FORCEORPHAN (#43)
* feat: Add INPUT_FORCEORPHAN option (close #42)
* docs: Add new section about Force orphan
2019-12-23 05:49:21 +09:00
peaceiris
e376bcf7c0 Revert "chore: remove paths-ignore of pr"
This reverts commit 2437fbe949.
2019-12-18 07:08:38 +09:00
Shohei Ueda
2437fbe949 chore: remove paths-ignore of pr 2019-12-16 12:44:08 +09:00
Shohei Ueda
1bf8e45e86 docs: Use Flutter beta channel (#61) 2019-12-16 12:43:18 +09:00
Shohei Ueda
26c5cb82dd chore: upgrade actions/checkout to v2 2019-12-14 18:03:52 +09:00
Shohei Ueda
fb16fe135c chore: Rename workflow name 2019-12-14 18:02:39 +09:00
Shohei Ueda
e13d24c2ac chore: Add Pull Request to stale target 2019-12-09 10:39:58 +09:00
Shohei Ueda
830cc44454 Update purge-readme-image-cache.yml 2019-12-09 10:38:57 +09:00
peaceiris
cf4667b165 gha: Remove checkout step 2019-12-08 17:47:22 +09:00
peaceiris
299744c4cc gha: Remove push trigger 2019-12-08 17:43:01 +09:00
peaceiris
817fe3379a gha: Fix one liner 2019-12-08 17:38:48 +09:00
peaceiris
dbec91074d gha: Add checkout step 2019-12-08 17:35:21 +09:00
peaceiris
3514e583e0 gha: Add workflow to purge readme image cache 2019-12-08 17:30:38 +09:00
peaceiris
6da534f570 docs: Pin action version to v2 2019-12-05 19:59:16 +09:00
peaceiris
0803e7e969 gha: Pin version actions/checkout to v1 2019-12-05 19:54:25 +09:00
Shohei Ueda
14ef8241ef Create stale.yml 2019-12-05 17:07:08 +09:00
peaceiris
7194caacc4 docs: Pin actions/checkout version to v1 2019-12-05 03:41:25 +09:00
peaceiris
93de081763 docs: Enhance Flutter example 2019-12-04 15:58:41 +09:00
Taiga Mikami
f035f9f5e7 docs: add flutter web workflow example (#56) 2019-12-04 15:49:03 +09:00
Shohei Ueda
9d15cc0dbc docs: Pin ubuntu version (#55) 2019-12-04 08:31:30 +09:00
Shohei Ueda
626ca71936 docs: Add stable tag v2 of peaceiris/actions-hugo 2019-11-28 20:49:06 +09:00
Shohei Ueda
e4b680c116 Update docker-image-ci.yml 2019-11-28 19:51:55 +09:00
Shohei Ueda
8563c806e5 Update docker-image-ci.yml 2019-11-28 19:35:49 +09:00
Shohei Ueda
0ce7e18faa Update README.md 2019-11-28 00:07:26 +09:00
peaceiris
46649571f8 docs: Add image 2019-11-22 12:50:27 +09:00
Shohei Ueda
83eaab4031 Update README.md 2019-11-22 12:40:57 +09:00
Shohei Ueda
81110be679 docs: update actions-hugo tag 2019-11-22 12:27:37 +09:00
Shohei Ueda
455788d397 Update README.md 2019-11-21 17:05:13 +09:00
Shohei Ueda
8aea3055ca docs: Add token difference table 2019-11-21 17:02:38 +09:00
Shohei Ueda
1f2f7ef05e Update README.md 2019-11-20 23:13:55 +09:00
peaceiris
141d3dbf3a docs: update mdbook example workflow 2019-11-20 18:16:58 +09:00
peaceiris
c656aacd4e docs: update mdbook example workflow 2019-11-20 18:15:13 +09:00
Shohei Ueda
34c4d59419 docs: Add link to mdbook 2019-11-20 18:00:18 +09:00
peaceiris
db893610ff docs: update toc 2019-11-20 17:52:26 +09:00
Shohei Ueda
8daaa39070 docs: Add mdbook example 2019-11-20 17:51:46 +09:00
Shohei Ueda
8dc241e75a docs: update cache step example for yarn
https://github.com/actions/cache/blob/master/examples.md#node---yarn
https://github.com/actions/cache/pull/70
2019-11-14 00:33:03 +09:00
Shohei Ueda
20ef467283 Update README.md 2019-11-13 11:08:54 +09:00
Shohei Ueda
49a4a6dfc2 Update README.md 2019-11-13 09:28:54 +09:00
Shohei Ueda
74185ffe80 docs: Add cache step to Python example
Close #48
2019-11-13 09:18:16 +09:00
Shohei Ueda
097933f4ab Update README.md 2019-11-12 11:00:34 +09:00
Shohei Ueda
8972cc626f Update README.md 2019-11-11 22:01:38 +09:00
Shohei Ueda
1468ca9775 docs: Fix cache step of React and Next example 2019-11-10 21:19:30 +09:00
peaceiris
b172208a72 Merge branch 'docs/add-cache-step' 2019-11-10 14:20:26 +09:00
peaceiris
645870064d docs: Add cache step 2019-11-10 14:19:52 +09:00
Shohei Ueda
8981758aad gha: update to macos-latest 2019-11-07 08:20:14 +09:00
Shohei Ueda
f3c1954c3b Update docker-image-ci.yml 2019-11-03 13:30:26 +09:00
peaceiris
f47e77b3ef github: Add issue template config
https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2019-10-29 09:50:58 +09:00
Shohei Ueda
0e1d168f48 Update issue templates 2019-10-29 09:46:29 +09:00
12 changed files with 503 additions and 81 deletions

31
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,31 @@
---
name: Bug report
about: Create a report to help us improve
title: 'Bug: This is a sample issue title'
labels: bug
assignees: peaceiris
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Your YAML file**
- A link to your repository
- A link to your YAML file
**Additional context**
Add any other context about the problem here.

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: GitHub Actions Community Forum
url: https://github.community/t5/GitHub-Actions/bd-p/actions
about: Please ask questions about GitHub Actions here.
- name: GitHub Pages help
url: https://help.github.com/en/github/working-with-github-pages
about: GitHub Pages documentaion here.

20
.github/ISSUE_TEMPLATE/proposal.md vendored Normal file
View File

@@ -0,0 +1,20 @@
---
name: Proposal
about: Suggest an idea for this project
title: 'proposal: This is a sample title'
labels: proposal
assignees: peaceiris
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View File

@@ -3,7 +3,11 @@ name: docker image ci
on:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'
branches:
- master
@@ -12,33 +16,25 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/checkout@v2
- name: build
env:
DOCKER_IMAGE: docker.pkg.github.com/${{ github.repository }}/action:latest
run: |
docker build . --file Dockerfile --tag ${DOCKER_IMAGE} ||
(echo -e "\e[31m[${GITHUB_WORKFLOW}] failed to build\e[m" && exit 1)
docker build . --file Dockerfile --tag ${DOCKER_IMAGE}
shellcheck:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- uses: actions/checkout@v2
- name: shellcheck
run: shellcheck ./entrypoint.sh
hadolint:
runs-on: macOS-10.14
runs-on: macos-latest
steps:
- uses: actions/checkout@master
with:
fetch-depth: 1
- name: hadolint
run: |
brew install hadolint
hadolint ./Dockerfile
- uses: actions/checkout@v2
- run: brew install hadolint
- run: hadolint ./Dockerfile

View File

@@ -0,0 +1,16 @@
name: Purge image cache
on:
schedule:
- cron: '54 18 * * */7'
jobs:
purge:
runs-on: ubuntu-18.04
steps:
- run: >
curl -sL https://github.com/${GITHUB_REPOSITORY} |
grep -oE '<img src="https?://camo.githubusercontent.com/[^"]+' |
sed -e 's/<img src="//' |
xargs -I % curl -sX PURGE %

17
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,17 @@
name: "Stale"
on:
schedule:
- cron: "6 6 * * *"
jobs:
stale:
runs-on: ubuntu-18.04
steps:
- uses: actions/stale@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
stale-pr-message: 'This pull request is stale because it has been open 21 days with no activity. Remove stale label or comment or this will be closed in 7 days.'
days-before-stale: 21
days-before-close: 7

24
.github/workflows/update-major-tag.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Update major tag
on:
release:
types: [published]
jobs:
update:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Update major tag
if: github.event.release.prerelease == false
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
export TAG_NAME="${GITHUB_REF##refs/tags/}"
export TAG_MAJOR="${TAG_NAME%%.*}"
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || git tag -d "${TAG_MAJOR}" ; git push --delete origin "${TAG_MAJOR}"
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || true
git push origin "${TAG_MAJOR}"

View File

@@ -1,4 +1,4 @@
FROM alpine:3.10.3
FROM alpine:3.11.2
RUN apk add --no-cache \
bash \

354
README.md
View File

@@ -11,20 +11,44 @@
## GitHub Actions for GitHub Pages
This is a **GitHub Action** to deploy your static files to **GitHub Pages**.
This deploy action can be combined simply and freely with [Static Site Generators]. (Hugo, MkDocs, Gatsby, GitBook, etc.)
This deploy action can be combined simply and freely with [Static Site Generators]. (Hugo, MkDocs, Gatsby, GitBook, mdBook, etc.)
[Static Site Generators]: https://www.staticgen.com/
The next example step will deploy `./public` directory to the remote `gh-pages` branch.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
```
The above example step will deploy `./public` directory to `gh-pages` branch.
Three tokens are supported.
| Token | Private repo | Public repo | Protocol | Setup |
|---|:---:|:---:|---|---|
| `GITHUB_TOKEN` | ✅️ | ❌️ | HTTPS | Unnecessary |
| `PERSONAL_TOKEN` | ✅️ | ✅️ | HTTPS | Necessary |
| `ACTIONS_DEPLOY_KEY` | ✅️ | ✅️ | SSH | Necessary |
Do you want to skip the docker build step? OK, the script mode is available.
```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/entrypoint.sh
bash ./entrypoint.sh
```
@@ -46,6 +70,9 @@ The above example step will deploy `./public` directory to `gh-pages` branch.
- [⭐️ Suppressing empty commits](#%EF%B8%8F-suppressing-empty-commits)
- [⭐️ Keeping existing files](#%EF%B8%8F-keeping-existing-files)
- [⭐️ Deploy to external repository](#%EF%B8%8F-deploy-to-external-repository)
- [⭐️ Force orphan](#%EF%B8%8F-force-orphan)
- [⭐️ Set Git username and email](#%EF%B8%8F-set-git-username-and-email)
- [⭐️ Set custom commit message](#%EF%B8%8F-set-custom-commit-message)
- [⭐️ Script mode](#%EF%B8%8F-script-mode)
- [Tips and FAQ](#tips-and-faq)
- [⭐️ Use the latest and specific release](#%EF%B8%8F-use-the-latest-and-specific-release)
@@ -57,6 +84,9 @@ The above example step will deploy `./public` directory to `gh-pages` branch.
- [⭐️ React and Next](#%EF%B8%8F-react-and-next)
- [⭐️ Vue and Nuxt](#%EF%B8%8F-vue-and-nuxt)
- [⭐️ Static Site Generators with Python](#%EF%B8%8F-static-site-generators-with-python)
- [⭐️ mdBook (Rust)](#%EF%B8%8F-mdbook-rust)
- [⭐️ Flutter Web](#%EF%B8%8F-flutter-web)
- [⭐️ Elm](#%EF%B8%8F-elm)
- [License](#license)
- [About the author](#about-the-author)
@@ -117,20 +147,20 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
# with:
# submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2.2.2
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.58.3'
hugo-version: '0.59.1'
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -165,6 +195,7 @@ PUBLISH_BRANCH: master # deploying branch
[User and Organization Pages sites]: https://help.github.com/en/articles/user-organization-and-project-pages#user-and-organization-pages-sites
![Change default branch](./images/default-branch.jpg)
![Change default branch](./images/user_repo.jpg)
<div align="right">
<a href="#table-of-contents">Back to TOC ☝️</a>
@@ -180,8 +211,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.5.0
+ uses: docker://peaceiris/gh-pages:v2.5.0
- uses: peaceiris/actions-gh-pages@v2
+ uses: docker://peaceiris/gh-pages:v2
```
- [peaceiris/gh-pages - Docker Hub](https://hub.docker.com/r/peaceiris/gh-pages)
@@ -218,7 +249,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -235,7 +266,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -254,7 +285,7 @@ For example:
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
EXTERNAL_REPOSITORY: username/external-repository
@@ -267,6 +298,55 @@ When you use `ACTIONS_DEPLOY_KEY`, set your private key to the repository which
Be careful, `GITHUB_TOKEN` has no permission to access to external repositories.
### ⭐️ Force orphan
From `v2.6.0`, we can set the `forceOrphan: true` option.
This allows you to make your publish branch with only the latest commit.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
forceOrphan: true
```
### ⭐️ Set Git username and email
Set custom `git config user.name` and `git config user.email`.
A commit is always created with the same user.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
username: "iris"
useremail: "iris@peaceiris.com"
```
### ⭐️ Set custom commit message
Set custom commit message.
When we create a commit with a message `docs: Update some post`, a deployment commit will be generated with a message `docs: Update some post ${GITHUB_SHA}`.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
with:
commitMessage: ${{ github.event.head_commit.message }}
```
### ⭐️ Script mode
From `v2.5.0`, we can run this action as a shell script.
@@ -283,7 +363,7 @@ There is no Docker build or pull step, so it will start immediately.
PUBLISH_DIR: ./public
SCRIPT_MODE: true
run: |
wget https://raw.githubusercontent.com/peaceiris/actions-gh-pages/v2.5.0/entrypoint.sh
wget https://raw.githubusercontent.com/peaceiris/actions-gh-pages/v2/entrypoint.sh
bash ./entrypoint.sh
```
@@ -377,18 +457,27 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- name: build
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- run: |
npm install
npm run build
- name: deploy
uses: peaceiris/actions-gh-pages@v2.5.0
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -416,27 +505,31 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- name: setup node
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: install
run: npm install
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: format
run: npm run format
- run: npm ci
- name: test
run: npm run test
- run: npm run format
- name: build
run: npm run build
- run: npm run test
- name: deploy
uses: peaceiris/actions-gh-pages@v2.5.0
- run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -466,27 +559,35 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- name: setup node
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: install
run: yarn install
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: build
run: yarn build
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: export
run: yarn export
- run: yarn install
- name: add nojekyll
run: touch ./out/.nojekyll
- run: yarn build
- run: yarn export
- run: touch ./out/.nojekyll
- name: deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -516,24 +617,29 @@ jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v1
- name: setup node
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: install
run: npm install
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: test
run: npm test
- run: npm ci
- name: generate
run: npm run generate
- run: npm test
- run: npm run generate
- name: deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
@@ -566,29 +672,161 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Set up Python
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: '3.6'
architecture: 'x64'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r ./requirements.txt
python3 -m pip install --upgrade pip
python3 -m pip install -r ./requirements.txt
- name: Build
run: mkdocs build
- run: mkdocs build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./site
```
### ⭐️ mdBook (Rust)
An example GitHub Actions workflow to deploy [rust-lang/mdBook] site to GitHub Pages.
[rust-lang/mdBook]: https://github.com/rust-lang/mdBook
- [peaceiris/actions-mdbook: GitHub Actions for mdBook (rust-lang/mdBook)](https://github.com/peaceiris/actions-mdbook)
```yaml
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.3.5'
# mdbook-version: 'latest'
- run: mdbook build
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./book
```
### ⭐️ Flutter Web
An exapmle workflow for [Flutter web project].
Setup [Flutter] with [subosito/flutter-action].
[Flutter]: https://github.com/flutter/flutter
[Flutter web project]: https://flutter.dev/docs/get-started/web
[subosito/flutter-action]: https://github.com/subosito/flutter-action
```yaml
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'beta'
- name: Install
run: |
flutter config --enable-web
flutter pub get
- name: Build
run: flutter build web
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./build/web
```
### ⭐️ Elm
An exapmle workflow for [Elm] with [justgook/setup-elm].
[Elm]: https://elm-lang.org
[justgook/setup-elm]: https://github.com/justgook/setup-elm
```yaml
name: github pages
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Elm
uses: justgook/setup-elm@v1
- name: Make
run: elm make --optimize src/Main.elm
- name: Move files
run: |
mkdir ./public
mv ./index.html ./public/
# If you have non-minimal setup with some assets and separate html/js files,
# provide --output=<output-file> option for `elm make` and remove this step
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
```
## License

View File

@@ -16,3 +16,26 @@ 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'
username:
description: 'Set Git user.name'
required: false
useremail:
description: 'Set Git user.email'
required: false
commitMessage:
description: 'Set custom commit message'
required: false
tagName:
description: 'Set tag name'
required: false
tagMessage:
description: 'Set tag message'
required: false
tagOverwrite:
description: 'Enable overwriting tag'
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
@@ -86,7 +92,7 @@ if git clone --depth=1 --single-branch --branch "${remote_branch}" "${remote_rep
git rm -r --ignore-unmatch '*'
fi
find "${GITHUB_WORKSPACE}/${PUBLISH_DIR}" -maxdepth 1 | \
find "${GITHUB_WORKSPACE}/${PUBLISH_DIR}" -maxdepth 1 -not -name ".git" -not -name ".github" | \
tail -n +2 | \
xargs -I % cp -rf % "${local_dir}/"
else
@@ -96,19 +102,62 @@ else
fi
# push to publishing branch
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
if [[ -n "${INPUT_USERNAME}" ]]; then
git config user.name "${INPUT_USERNAME}"
else
git config user.name "${GITHUB_ACTOR}"
fi
if [[ -n "${INPUT_USEREMAIL}" ]]; then
git config user.email "${INPUT_USEREMAIL}"
else
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
fi
git remote rm origin || true
git remote add origin "${remote_repo}"
git add --all
print_info "Allowing empty commits: ${INPUT_EMPTYCOMMITS}"
COMMIT_MESSAGE="Automated deployment: $(date -u) ${GITHUB_SHA}"
if [ -n "${INPUT_COMMITMESSAGE}" ]; then
BASE_COMMIT_MESSAGE="${INPUT_COMMITMESSAGE}"
else
BASE_COMMIT_MESSAGE="Automated deployment: $(date -u)"
fi
if [ -n "${EXTERNAL_REPOSITORY}" ]; then
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_REPOSITORY}@${GITHUB_SHA}"
else
COMMIT_MESSAGE="${BASE_COMMIT_MESSAGE} ${GITHUB_SHA}"
fi
if [[ ${INPUT_EMPTYCOMMITS} == "false" ]]; then
git commit -m "${COMMIT_MESSAGE}" || skip
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
if [[ -n "${INPUT_TAGNAME}" ]]; then
print_info "Tag name: ${INPUT_TAGNAME}"
print_info "Tag message: ${INPUT_TAGMESSAGE}"
print_info "Tag overwrite: ${INPUT_TAGOVERWRITE}"
if [[ -n "${INPUT_TAGMESSAGE}" ]]; then
GIT_TAG_MESSAGE="${INPUT_TAGMESSAGE}"
else
GIT_TAG_MESSAGE="Deployment ${INPUT_TAGNAME}"
fi
if [[ "${INPUT_TAGOVERWRITE}" == "true" ]]; then
GIT_TAG_OPTION="--force"
else
GIT_TAG_OPTION=""
fi
git tag "${GIT_TAG_OPTION}" -a "${INPUT_TAGNAME}" -m "${GIT_TAG_MESSAGE}"
git push "${GIT_TAG_OPTION}" origin "${INPUT_TAGNAME}"
fi
print_info "${GITHUB_SHA} was successfully deployed"

BIN
images/user_repo.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB