Compare commits

...

40 Commits

Author SHA1 Message Date
peaceiris
05a7c4edd9 chore(release): 3.7.0-8
Some checks failed
Release / release (push) Has been cancelled
2020-08-09 09:49:51 +09:00
peaceiris
4c2d9ecb85 chore(release): Add build assets 2020-08-09 09:49:50 +09:00
peaceiris
6b302fdd50 chore: Add vscode devcontainer 2020-08-09 09:49:07 +09:00
Shohei Ueda
f80024481c refactor: Enhance log (#444) 2020-08-09 09:48:27 +09:00
Shohei Ueda
ba912f746b ci: Add actions runner env (#443)
DEBIAN_FRONTEND="noninteractive"
ImageVersion="20200717.1"
GITHUB_SERVER_URL="https://github.com"
GITHUB_GRAPHQL_URL="https://api.github.com/graphql"
GITHUB_ACTOR="peaceiris"
GITHUB_REPOSITORY="actions/pages"
RUNNER_OS="Linux"
RUNNER_USER="runner"
RUNNER_TEMP="/home/runner/work/_temp"
RUNNER_WORKSPACE="/home/runner/work/pages"
2020-08-06 11:36:20 +09:00
dependabot[bot]
02db90c5c8 deps: bump @types/jest from 26.0.8 to 26.0.9 (#442)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.8 to 26.0.9.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-06 11:33:42 +09:00
dependabot[bot]
b5599b36fd deps: bump @types/node from 12.12.53 to 12.12.54 (#441)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.53 to 12.12.54.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-06 11:31:47 +09:00
dependabot[bot]
3f71ec211a deps: bump @types/jest from 26.0.7 to 26.0.8 (#439)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.7 to 26.0.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-03 16:29:29 +09:00
peaceiris
5bfcd3f213 chore(release): Remove build assets [skip ci] 2020-08-02 15:12:30 +09:00
peaceiris
3226514b95 chore(release): 3.7.0-7
Some checks failed
Release / release (push) Has been cancelled
2020-08-02 15:12:29 +09:00
peaceiris
4f4235c78c chore(release): Add build assets 2020-08-02 15:12:27 +09:00
Shohei Ueda
079d48367e feat: Add .nojekyll file by default for all branches (#438) 2020-08-02 15:11:20 +09:00
dependabot[bot]
4fb3d60161 deps: bump jest-circus from 26.1.0 to 26.2.2 (#435)
Bumps [jest-circus](https://github.com/facebook/jest/tree/HEAD/packages/jest-circus) from 26.1.0 to 26.2.2.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v26.2.2/packages/jest-circus)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-01 00:19:30 +09:00
dependabot[bot]
0c8fc2d5e6 deps: bump eslint-plugin-jest from 23.19.0 to 23.20.0 (#432)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.19.0 to 23.20.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.19.0...v23.20.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-08-01 00:19:18 +09:00
Shohei Ueda
4bf31e4520 deps: Apply npm audit fix (#434)
* ci: fix npm audit step
2020-07-31 23:47:10 +09:00
Shohei Ueda
0794e07c99 deps: bump node from 12.18.2 to 12.18.3 (#431) 2020-07-28 23:41:56 +09:00
Shohei Ueda
2b5ce90dc9 ci: reuse NODE_VERSION in nodesource URL (#430) 2020-07-28 23:28:25 +09:00
Shohei Ueda
681dcab3fd ci: enhance version log (#429) 2020-07-28 22:00:59 +09:00
Shohei Ueda
70c0076457 ci: change base image from Debian to Ubuntu 18.04 (#428)
Change base docker image from `node:x.x.x-buster-slim` to `ubuntu:18.04`
The image size reduces from 1.05GB to 327MB

- Install Node.js via nodesource https://github.com/nodesource/distributions
- Install Git via ppa:git-core/ppa https://git-scm.com/download/linux
2020-07-28 21:47:35 +09:00
Shohei Ueda
a49e738c32 ci: Add npm audit (#426) 2020-07-28 18:59:51 +09:00
Shohei Ueda
5d053d30d0 ci: Clean up apt cache and junk (#425) 2020-07-28 18:59:09 +09:00
Shohei Ueda
4cf5105929 ci: Set default branch to main (#424)
git config --global init.defaultBranch main

https://github.blog/2020-07-27-highlights-from-git-2-28/
2020-07-28 17:35:58 +09:00
dependabot[bot]
2392f69e4d deps: bump eslint-plugin-jest from 23.18.2 to 23.19.0 (#423)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.18.2 to 23.19.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.18.2...v23.19.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-28 11:27:02 +09:00
Shohei Ueda
fecb564860 deps: bump git from 2.27.0 to 2.28.0 (#422) 2020-07-28 02:20:19 +09:00
dependabot[bot]
7259f5ccc2 deps: bump eslint-plugin-jest from 23.18.0 to 23.18.2 (#420)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.18.0 to 23.18.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v23.18.0...v23.18.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-27 15:19:43 +09:00
dependabot[bot]
c8397307b4 deps: bump @types/node from 12.12.52 to 12.12.53 (#421)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.52 to 12.12.53.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-27 15:17:57 +09:00
peaceiris
7dd962e52e docs: Add exclude_assets section 2020-07-26 00:32:49 +09:00
peaceiris
ded3953565 docs: bump hugo from 0.74.2 to 0.74.3 2020-07-26 00:19:04 +09:00
Shohei Ueda
71958c534b ci: add env (#419)
ENV LANG="C.UTF-8"
ENV ImageVersion="20200625.0"
ENV GITHUB_API_URL="https://api.github.com"
ENV RUNNER_TOOL_CACHE="/opt/hostedtoolcache"
ENV GITHUB_REPOSITORY_OWNER="peaceiris"
ENV GITHUB_ACTIONS="true"
2020-07-26 00:12:46 +09:00
Shohei Ueda
eca3d9d25e ci: set env CI to true (#418) 2020-07-26 00:03:59 +09:00
Shohei Ueda
24d40fe124 ci: add workflow_dispatch and schedule 2020-07-25 23:59:01 +09:00
peaceiris
19b0b66a7c chore(release): Remove build assets [skip ci] 2020-07-25 21:55:02 +09:00
peaceiris
23abc3124a chore(release): 3.7.0-6
Some checks failed
Release / release (push) Has been cancelled
2020-07-25 21:55:01 +09:00
peaceiris
866d7e715c chore(release): Add build assets 2020-07-25 21:55:00 +09:00
Shohei Ueda
6f45501409 feat: exclude_assets supports glob patterns (#417)
Related to #163

https://github.com/actions/toolkit/tree/main/packages/glob
2020-07-25 21:54:06 +09:00
peaceiris
bf46251210 chore(release): Remove build assets [skip ci] 2020-07-25 20:53:29 +09:00
peaceiris
f8993157cb chore(release): 3.7.0-5
Some checks failed
Release / release (push) Has been cancelled
2020-07-25 20:53:29 +09:00
peaceiris
9cf67ec63b chore(release): Add build assets 2020-07-25 20:53:27 +09:00
Shohei Ueda
0f5c65e140 feat: Add exclude_assets option (#416)
Related to #163
2020-07-25 20:52:35 +09:00
peaceiris
2046290e2b chore(release): Remove build assets [skip ci] 2020-07-25 19:37:28 +09:00
19 changed files with 631 additions and 404 deletions

View File

@@ -0,0 +1,34 @@
{
"name": "Node.js",
"image": "docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest",
// Use 'settings' to set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
// Add the IDs of extensions you want installed when the container is created in the array below.
"extensions": [
"bungcip.better-toml",
"EditorConfig.EditorConfig",
"donjayamanne.githistory",
"eamodio.gitlens",
"oderwat.indent-rainbow",
"yzhang.markdown-all-in-one",
"shd101wyy.markdown-preview-enhanced",
"christian-kohler.path-intellisense",
"lfs.vscode-emacs-friendly",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner",
"VisualStudioExptTeam.vscodeintellicode"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [3000],
// Specifies a command that should be run after the container has been created.
"postCreateCommand": "npm ci",
// Comment out the next line to run as root instead.
// "remoteUser": "runner"
}

View File

@@ -1,6 +1,9 @@
name: 'Dev Image CI'
on:
workflow_dispatch:
schedule:
- cron: '11 11 * * *'
push:
branches:
- main
@@ -36,6 +39,7 @@ jobs:
- run: docker-compose pull --quiet
if: github.event_name == 'pull_request'
- run: make build
- run: docker images
- run: make ci
- run: make all
- run: docker-compose push

View File

@@ -48,6 +48,15 @@ jobs:
- run: npm ci
- name: npm audit
if: startsWith(matrix.os, 'ubuntu-18.04')
run: |
npm audit > ./audit.log || true
if ! [ "$(cat ./audit.log | wc -l)" = 1 ]; then
echo "::warning::$(cat ./audit.log)"
fi
rm ./audit.log
- name: Run prettier
if: startsWith(matrix.os, 'ubuntu-18.04')
run: npm run format:check

2
.nvmrc
View File

@@ -1 +1 @@
12.18.2
12.18.3

View File

@@ -2,6 +2,84 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
# [3.7.0-8](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-7...v3.7.0-8) (2020-08-09)
### chore
* Add vscode devcontainer ([6b302fd](https://github.com/peaceiris/actions-gh-pages/commit/6b302fdd506eb1874da1e7245b19bc66c4db0bfc))
### ci
* Add actions runner env (#443) ([ba912f7](https://github.com/peaceiris/actions-gh-pages/commit/ba912f746bdcba752e96a9c6731af9f9ff289f0e)), closes [#443](https://github.com/peaceiris/actions-gh-pages/issues/443)
### deps
* bump @types/jest from 26.0.7 to 26.0.8 (#439) ([3f71ec2](https://github.com/peaceiris/actions-gh-pages/commit/3f71ec211a08aef8dde6999c8ee81dae974a26f2)), closes [#439](https://github.com/peaceiris/actions-gh-pages/issues/439)
* bump @types/jest from 26.0.8 to 26.0.9 (#442) ([02db90c](https://github.com/peaceiris/actions-gh-pages/commit/02db90c5c8564c8b0c1432aca1b52d66d10c7583)), closes [#442](https://github.com/peaceiris/actions-gh-pages/issues/442)
* bump @types/node from 12.12.53 to 12.12.54 (#441) ([b5599b3](https://github.com/peaceiris/actions-gh-pages/commit/b5599b36fdd4acffdb3fb4d55bb94ac76a2b3b98)), closes [#441](https://github.com/peaceiris/actions-gh-pages/issues/441)
### refactor
* Enhance log (#444) ([f800244](https://github.com/peaceiris/actions-gh-pages/commit/f80024481c7939706fac36cee86324c56371d6fd)), closes [#444](https://github.com/peaceiris/actions-gh-pages/issues/444)
# [3.7.0-7](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-6...v3.7.0-7) (2020-08-02)
### ci
* add env (#419) ([71958c5](https://github.com/peaceiris/actions-gh-pages/commit/71958c534b1f4dadbef055d8851541314574559b)), closes [#419](https://github.com/peaceiris/actions-gh-pages/issues/419)
* Add npm audit (#426) ([a49e738](https://github.com/peaceiris/actions-gh-pages/commit/a49e738c320151f18296dbcda6a418408cd64ea3)), closes [#426](https://github.com/peaceiris/actions-gh-pages/issues/426)
* add workflow_dispatch and schedule ([24d40fe](https://github.com/peaceiris/actions-gh-pages/commit/24d40fe124feecb6c5f4259a1906fcafd603b8f6))
* change base image from Debian to Ubuntu 18.04 (#428) ([70c0076](https://github.com/peaceiris/actions-gh-pages/commit/70c0076457b26d38a26bacbac279b8bf35cc47c8)), closes [#428](https://github.com/peaceiris/actions-gh-pages/issues/428)
* Clean up apt cache and junk (#425) ([5d053d3](https://github.com/peaceiris/actions-gh-pages/commit/5d053d30d0c607d63ce46c3d7ce321bfdb1c11c1)), closes [#425](https://github.com/peaceiris/actions-gh-pages/issues/425)
* enhance version log (#429) ([681dcab](https://github.com/peaceiris/actions-gh-pages/commit/681dcab3fd25a0f24dc66bb2767c0e37934aad5c)), closes [#429](https://github.com/peaceiris/actions-gh-pages/issues/429)
* reuse NODE_VERSION in nodesource URL (#430) ([2b5ce90](https://github.com/peaceiris/actions-gh-pages/commit/2b5ce90dc9ac2814d6e8ee5322d3e18b42ad008f)), closes [#430](https://github.com/peaceiris/actions-gh-pages/issues/430)
* Set default branch to main (#424) ([4cf5105](https://github.com/peaceiris/actions-gh-pages/commit/4cf510592915a8c58f536094aa9b881196852ce1)), closes [#424](https://github.com/peaceiris/actions-gh-pages/issues/424)
* set env CI to true (#418) ([eca3d9d](https://github.com/peaceiris/actions-gh-pages/commit/eca3d9d25efd39b60b2e32fe85e94b53951f9096)), closes [#418](https://github.com/peaceiris/actions-gh-pages/issues/418)
### deps
* Apply npm audit fix (#434) ([4bf31e4](https://github.com/peaceiris/actions-gh-pages/commit/4bf31e45208169b022dc9b870de61d6eea322d29)), closes [#434](https://github.com/peaceiris/actions-gh-pages/issues/434)
* bump @types/node from 12.12.52 to 12.12.53 (#421) ([c839730](https://github.com/peaceiris/actions-gh-pages/commit/c8397307b446e9d81d20682060c40e8dd4de96b0)), closes [#421](https://github.com/peaceiris/actions-gh-pages/issues/421)
* bump eslint-plugin-jest from 23.18.0 to 23.18.2 (#420) ([7259f5c](https://github.com/peaceiris/actions-gh-pages/commit/7259f5ccc2d61b325b9c8f33d570170a345d496b)), closes [#420](https://github.com/peaceiris/actions-gh-pages/issues/420)
* bump eslint-plugin-jest from 23.18.2 to 23.19.0 (#423) ([2392f69](https://github.com/peaceiris/actions-gh-pages/commit/2392f69e4dd8264685215438922790389daedb24)), closes [#423](https://github.com/peaceiris/actions-gh-pages/issues/423)
* bump eslint-plugin-jest from 23.19.0 to 23.20.0 (#432) ([0c8fc2d](https://github.com/peaceiris/actions-gh-pages/commit/0c8fc2d5e699acedef9512db7f3c240fa110285a)), closes [#432](https://github.com/peaceiris/actions-gh-pages/issues/432)
* bump git from 2.27.0 to 2.28.0 (#422) ([fecb564](https://github.com/peaceiris/actions-gh-pages/commit/fecb5648609eee9e7add9fa2d5a9397abb3398db)), closes [#422](https://github.com/peaceiris/actions-gh-pages/issues/422)
* bump jest-circus from 26.1.0 to 26.2.2 (#435) ([4fb3d60](https://github.com/peaceiris/actions-gh-pages/commit/4fb3d60161340ada324107b29fe7f4aa4a6487f0)), closes [#435](https://github.com/peaceiris/actions-gh-pages/issues/435)
* bump node from 12.18.2 to 12.18.3 (#431) ([0794e07](https://github.com/peaceiris/actions-gh-pages/commit/0794e07c99f802bb0f1a4c00972e46b381a360ee)), closes [#431](https://github.com/peaceiris/actions-gh-pages/issues/431)
### docs
* Add exclude_assets section ([7dd962e](https://github.com/peaceiris/actions-gh-pages/commit/7dd962e52e7deb89dfa860da173ddbb96462d371))
* bump hugo from 0.74.2 to 0.74.3 ([ded3953](https://github.com/peaceiris/actions-gh-pages/commit/ded3953565f3dde01b9678834705b16df9be1df6))
### feat
* Add .nojekyll file by default for all branches (#438) ([079d483](https://github.com/peaceiris/actions-gh-pages/commit/079d48367e5a8bc6448f5e9846666d27ea66e1e5)), closes [#438](https://github.com/peaceiris/actions-gh-pages/issues/438)
# [3.7.0-6](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-5...v3.7.0-6) (2020-07-25)
### feat
* exclude_assets supports glob patterns (#417) ([6f45501](https://github.com/peaceiris/actions-gh-pages/commit/6f45501409dbe16857c00f6d40a51bea56254f2b)), closes [#417](https://github.com/peaceiris/actions-gh-pages/issues/417) [#163](https://github.com/peaceiris/actions-gh-pages/issues/163)
# [3.7.0-5](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-4...v3.7.0-5) (2020-07-25)
### feat
* Add exclude_assets option (#416) ([0f5c65e](https://github.com/peaceiris/actions-gh-pages/commit/0f5c65e1408b30fe461ba319ca9a01d20c293cd4)), closes [#416](https://github.com/peaceiris/actions-gh-pages/issues/416) [#163](https://github.com/peaceiris/actions-gh-pages/issues/163)
# [3.7.0-4](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-3...v3.7.0-4) (2020-07-25)

View File

@@ -1,31 +1,55 @@
ARG NODE_VERSION
FROM node:${NODE_VERSION}-buster-slim
FROM ubuntu:18.04
SHELL ["/bin/bash", "-l", "-c"]
RUN apt-get update && \
apt-get install -y --no-install-recommends software-properties-common gnupg && \
add-apt-repository ppa:git-core/ppa && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
ca-certificates \
git \
curl \
wget \
ssh \
vim && \
rm -rf /var/lib/apt/lists/* && \
npm i -g npm
apt-get autoclean && \
apt-get clean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
WORKDIR /git
ENV GIT_VERSION="2.27.0"
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
rm "./v${GIT_VERSION}.tar.gz" && \
cd "./git-${GIT_VERSION}" && \
make configure && \
./configure --prefix=/usr && \
make all && \
make install
WORKDIR /node
ARG NODE_VERSION
RUN curl -o nodejs.deb "https://deb.nodesource.com/node_${NODE_VERSION%%.*}.x/pool/main/n/nodejs/nodejs_${NODE_VERSION}-1nodesource1_amd64.deb" && \
apt-get update && \
apt-get install -y --no-install-recommends ./nodejs.deb && \
npm i -g npm && \
curl -sL https://deb.nodesource.com/test | bash - && \
rm -rf /var/lib/apt/lists/* && \
rm -rf /node
WORKDIR /repo
ENV DEBIAN_FRONTEND="noninteractive"
ENV LANG="C.UTF-8"
ENV CI="true"
ENV ImageVersion="20200717.1"
ENV GITHUB_SERVER_URL="https://github.com"
ENV GITHUB_API_URL="https://api.github.com"
ENV GITHUB_GRAPHQL_URL="https://api.github.com/graphql"
ENV GITHUB_REPOSITORY_OWNER="peaceiris"
ENV GITHUB_ACTIONS="true"
ENV GITHUB_ACTOR="peaceiris"
ENV GITHUB_REPOSITORY="actions/pages"
ENV RUNNER_OS="Linux"
ENV RUNNER_TOOL_CACHE="/opt/hostedtoolcache"
ENV RUNNER_USER="runner"
ENV RUNNER_TEMP="/home/runner/work/_temp"
ENV RUNNER_WORKSPACE="/home/runner/work/pages"
RUN echo "node version: $(node -v)" && \
echo "npm version: $(npm -v)" && \
git --version && \
git config --global init.defaultBranch main && \
git config --global init.defaultBranch
CMD [ "bash" ]

View File

@@ -76,6 +76,7 @@ All Actions runners: Linux (Ubuntu), macOS, and Windows are supported.
- [⭐️ Target Branch `publish_branch`](#%EF%B8%8F-target-branch-publish_branch)
- [⭐️ Source Directory `publish_dir`](#%EF%B8%8F-source-directory-publish_dir)
- [⭐️ Deploy to Subdirectory `destination_dir`](#%EF%B8%8F-deploy-to-subdirectory-destination_dir)
- [⭐️ Filter publishing assets `exclude_assets`](#%EF%B8%8F-filter-publishing-assets-exclude_assets)
- [⭐️ Add CNAME file `cname`](#%EF%B8%8F-add-cname-file-cname)
- [⭐️ Enable Built-in Jekyll `enable_jekyll`](#%EF%B8%8F-enable-built-in-jekyll-enable_jekyll)
- [⭐️ Allow empty commits `allow_empty_commit`](#%EF%B8%8F-allow-empty-commits-allow_empty_commit)
@@ -141,7 +142,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.74.2'
hugo-version: '0.74.3'
- name: Build
run: hugo --minify
@@ -275,12 +276,49 @@ A destination subdirectory on a publishing branch. The default is empty.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-0
uses: peaceiris/actions-gh-pages@v3.7.0-6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: subdir
```
### ⭐️ Filter publishing assets `exclude_assets`
*This feature is on beta.*
*Any feedback is welcome at [Issue #163](https://github.com/peaceiris/actions-gh-pages/issues/163)*
Set files or directories to exclude from publishing assets.
The default is `.github`.
Values should be split with a comma.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
exclude_assets: '.github,exclude-file1,exclude-file2'
```
Set `exclude_assets` to empty for including the `.github` directory to deployment assets.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
exclude_assets: ''
```
The `exclude_assets` option supports glob patterns.
```yaml
- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-6
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
exclude_assets: '.github,exclude-file.txt,exclude-dir/**.txt'
```
### ⭐️ Add CNAME file `cname`
To add `CNAME` file, we can set the `cname` option.

View File

@@ -53,6 +53,7 @@ function getInputsLog(authMethod: string, inps: Inputs): string {
[INFO] TagMessage: ${inps.TagMessage}
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
[INFO] CNAME: ${inps.CNAME}
[INFO] ExcludeAssets ${inps.ExcludeAssets}
`;
}
@@ -121,6 +122,7 @@ describe('getInputs()', () => {
expect(inps.TagMessage).toMatch('');
expect(inps.DisableNoJekyll).toBe(false);
expect(inps.CNAME).toMatch('');
expect(inps.ExcludeAssets).toMatch('.github');
});
test('get spec inputs', () => {
@@ -142,6 +144,7 @@ describe('getInputs()', () => {
process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
process.env['INPUT_CNAME'] = 'github.com';
process.env['INPUT_EXCLUDE_ASSETS'] = '.github';
const inps: Inputs = getInputs();
@@ -163,6 +166,7 @@ describe('getInputs()', () => {
expect(inps.TagMessage).toMatch('Deployment v1.2.3');
expect(inps.DisableNoJekyll).toBe(true);
expect(inps.CNAME).toMatch('github.com');
expect(inps.ExcludeAssets).toMatch('.github');
});
test('get spec inputs enable_jekyll', () => {

View File

@@ -40,6 +40,7 @@ describe('setRepo()', () => {
// process.env['INPUT_TAG_MESSAGE'] = 'Deployment v1.2.3';
// process.env['INPUT_DISABLE_NOJEKYLL'] = 'true';
// process.env['INPUT_CNAME'] = 'github.com';
process.env['INPUT_EXCLUDE_ASSETS'] = '.github';
const inps: Inputs = getInputs();
const remoteURL = 'https://x-access-token:pat@github.com/actions/pages.git';
const date = new Date();

View File

@@ -70,28 +70,14 @@ async function getWorkDir(): Promise<string> {
}
describe('addNoJekyll()', () => {
test('add .nojekyll gh-pages', async () => {
test('add .nojekyll', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, false, 'gh-pages');
const test = fs.existsSync(filepath);
expect(test).toBe(true);
fs.unlinkSync(filepath);
});
test('add .nojekyll master', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, false, 'master');
await addNoJekyll(workDir, false);
const test = fs.existsSync(filepath);
expect(test).toBe(true);
@@ -106,57 +92,21 @@ describe('addNoJekyll()', () => {
const filepath = path.join(workDir, '.nojekyll');
fs.closeSync(fs.openSync(filepath, 'w'));
await addNoJekyll(workDir, false, 'master');
await addNoJekyll(workDir, false);
const test = fs.existsSync(filepath);
expect(test).toBe(true);
fs.unlinkSync(filepath);
});
test('not add .nojekyll disable_nojekyll gh-pages', async () => {
test('not add .nojekyll disable_nojekyll', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, true, 'gh-pages');
const test = fs.existsSync(filepath);
expect(test).toBe(false);
});
test('not add .nojekyll disable_nojekyll master', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, true, 'master');
const test = fs.existsSync(filepath);
expect(test).toBe(false);
});
test('not add .nojekyll other-branch', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, false, 'other-branch');
const test = fs.existsSync(filepath);
expect(test).toBe(false);
});
test('not add .nojekyll disable_nojekyll other-branch', async () => {
let workDir = '';
(async (): Promise<void> => {
workDir = await getWorkDir();
})();
const filepath = path.join(workDir, '.nojekyll');
await addNoJekyll(workDir, true, 'other-branch');
await addNoJekyll(workDir, true);
const test = fs.existsSync(filepath);
expect(test).toBe(false);
});

View File

@@ -73,3 +73,7 @@ inputs:
cname:
description: 'Set custom domain'
required: false
exclude_assets:
description: 'Set files or directories to exclude from a publish directory.'
required: false
default: '.github'

File diff suppressed because one or more lines are too long

637
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.7.0-4",
"version": "3.7.0-8",
"description": "GitHub Actions for GitHub Pages",
"main": "lib/index.js",
"engines": {
@@ -57,10 +57,11 @@
"@actions/core": "^1.2.4",
"@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0",
"@actions/glob": "^0.1.0",
"@actions/io": "^1.0.2"
},
"devDependencies": {
"@types/jest": "^26.0.7",
"@types/jest": "^26.0.9",
"@types/js-yaml": "^3.12.4",
"@types/node": "~12",
"@typescript-eslint/eslint-plugin": "^2.34.0",
@@ -68,11 +69,11 @@
"@zeit/ncc": "^0.22.3",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"jest": "^25.5.4",
"jest-circus": "^26.1.0",
"jest-circus": "^26.2.2",
"js-yaml": "^3.14.0",
"lint-staged": "^10.2.11",
"prettier": "2.0.5",

View File

@@ -28,6 +28,7 @@ export function showInputs(inps: Inputs): void {
[INFO] TagMessage: ${inps.TagMessage}
[INFO] EnableJekyll (DisableNoJekyll): ${inps.DisableNoJekyll}
[INFO] CNAME: ${inps.CNAME}
[INFO] ExcludeAssets ${inps.ExcludeAssets}
`);
}
@@ -65,7 +66,8 @@ export function getInputs(): Inputs {
TagName: core.getInput('tag_name'),
TagMessage: core.getInput('tag_message'),
DisableNoJekyll: useBuiltinJekyll,
CNAME: core.getInput('cname')
CNAME: core.getInput('cname'),
ExcludeAssets: core.getInput('exclude_assets')
};
return inps;

View File

@@ -1,6 +1,7 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import * as glob from '@actions/glob';
import path from 'path';
import fs from 'fs';
import {Inputs, CmdResult} from './interfaces';
@@ -12,12 +13,36 @@ export async function createBranchForce(branch: string): Promise<void> {
return;
}
export async function copyAssets(publishDir: string, destDir: string): Promise<void> {
export async function deleteExcludedAssets(destDir: string, excludeAssets: string): Promise<void> {
core.info(`[INFO] delete excluded assets`);
const excludedAssetNames: Array<string> = excludeAssets.split(',');
const excludedAssetPaths = ((): Array<string> => {
const paths: Array<string> = [];
for (const pattern of excludedAssetNames) {
paths.push(path.join(destDir, pattern));
}
return paths;
})();
const globber = await glob.create(excludedAssetPaths.join('\n'));
for await (const asset of globber.globGenerator()) {
core.info(`[INFO] delete ${asset}`);
io.rmRF(asset);
}
return;
}
export async function copyAssets(
publishDir: string,
destDir: string,
excludeAssets: string
): Promise<void> {
core.info(`[INFO] prepare publishing assets`);
const copyOpts = {recursive: true, force: true};
const files = fs.readdirSync(publishDir);
core.debug(`${files}`);
for await (const file of files) {
if (file.endsWith('.git') || file.endsWith('.github')) {
if (file === '.git') {
core.info(`[INFO] skip ${file}`);
continue;
}
const filePublishPath = path.join(publishDir, file);
@@ -26,10 +51,12 @@ export async function copyAssets(publishDir: string, destDir: string): Promise<v
if (fs.existsSync(destPath) === false) {
await createDir(destPath);
}
await io.cp(filePublishPath, fileDestPath, copyOpts);
core.info(`[INFO] copy ${file}`);
await io.cp(filePublishPath, fileDestPath, copyOpts);
}
await deleteExcludedAssets(destDir, excludeAssets);
return;
}
@@ -52,9 +79,10 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
core.info(`[INFO] ForceOrphan: ${inps.ForceOrphan}`);
if (inps.ForceOrphan) {
await createDir(destDir);
core.info(`[INFO] chdir ${workDir}`);
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, destDir);
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
return;
}
@@ -78,37 +106,31 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
);
if (result.exitcode === 0) {
await createDir(destDir);
process.chdir(destDir);
if (inps.DestinationDir !== '') {
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
core.info(`[INFO] clean up ${destDir}`);
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
if (inps.KeepFiles) {
core.info('[INFO] Keep existing files');
} else {
core.info(`[INFO] clean up ${destDir}`);
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
core.info(`[INFO] clean up ${destDir}`);
core.info(`[INFO] chdir ${destDir}`);
process.chdir(destDir);
await exec.exec('git', ['rm', '-r', '--ignore-unmatch', '*']);
}
await copyAssets(publishDir, destDir);
core.info(`[INFO] chdir ${workDir}`);
process.chdir(workDir);
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
return;
} else {
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
}
} catch (e) {
core.info(`[INFO] first deployment, create new branch ${inps.PublishBranch}`);
core.info(e.message);
core.info(`[INFO] ${e.message}`);
await createDir(destDir);
core.info(`[INFO] chdir ${workDir}`);
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
await copyAssets(publishDir, destDir);
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
return;
}
}

View File

@@ -17,6 +17,7 @@ export interface Inputs {
readonly TagMessage: string;
readonly DisableNoJekyll: boolean;
readonly CNAME: string;
readonly ExcludeAssets: string;
}
export interface CmdResult {

View File

@@ -48,7 +48,7 @@ export async function run(): Promise<void> {
const unixTime = date.getTime();
const workDir = await getWorkDirName(`${unixTime}`);
await setRepo(inps, remoteURL, workDir);
await addNoJekyll(workDir, inps.DisableNoJekyll, inps.PublishBranch);
await addNoJekyll(workDir, inps.DisableNoJekyll);
await addCNAME(workDir, inps.CNAME);
core.endGroup();

View File

@@ -29,22 +29,16 @@ export async function createDir(dirPath: string): Promise<void> {
return;
}
export async function addNoJekyll(
workDir: string,
DisableNoJekyll: boolean,
PublishBranch: string
): Promise<void> {
export async function addNoJekyll(workDir: string, DisableNoJekyll: boolean): Promise<void> {
if (DisableNoJekyll) {
return;
}
if (PublishBranch === 'master' || PublishBranch === 'gh-pages') {
const filepath = path.join(workDir, '.nojekyll');
if (fs.existsSync(filepath)) {
return;
}
fs.closeSync(fs.openSync(filepath, 'w'));
core.info(`[INFO] Created ${filepath}`);
const filepath = path.join(workDir, '.nojekyll');
if (fs.existsSync(filepath)) {
return;
}
fs.closeSync(fs.openSync(filepath, 'w'));
core.info(`[INFO] Created ${filepath}`);
}
export async function addCNAME(workDir: string, content: string): Promise<void> {