Compare commits

...

31 Commits

Author SHA1 Message Date
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
peaceiris
600bb6caa2 chore(release): 3.7.0-4
Some checks failed
Release / release (push) Has been cancelled
2020-07-25 19:37:27 +09:00
peaceiris
20912713da chore(release): Add build assets 2020-07-25 19:37:25 +09:00
Andreas Linde
674c2318ce fix: copyAssets() for destination_dir (#414) 2020-07-25 19:36:43 +09:00
peaceiris
0b4686e3a6 chore(release): Remove build assets [skip ci] 2020-07-24 21:33:54 +09:00
peaceiris
1029512144 chore(release): 3.7.0-3
Some checks failed
Release / release (push) Has been cancelled
2020-07-24 21:33:53 +09:00
peaceiris
6c430d988e chore(release): Add build assets 2020-07-24 21:33:51 +09:00
Shohei Ueda
6f6bb2661a fix: set full path of publishing assets (#413)
https://github.com/peaceiris/actions-gh-pages/issues/410#issuecomment-663507581
2020-07-24 21:33:08 +09:00
dependabot[bot]
d1700b5653 deps: bump @types/jest from 26.0.5 to 26.0.7 (#411)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.5 to 26.0.7.
- [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-07-24 11:37:53 +09:00
dependabot[bot]
1b5d710b24 deps: bump @types/node from 12.12.51 to 12.12.52 (#412)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.51 to 12.12.52.
- [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-24 11:37:39 +09:00
peaceiris
3667febec5 refactor: change message type from warning to info 2020-07-24 00:49:02 +09:00
peaceiris
8546b0c56b chore(release): Remove build assets [skip ci] 2020-07-24 00:42:18 +09:00
peaceiris
2c04f23922 chore(release): 3.7.0-2
Some checks failed
Release / release (push) Has been cancelled
2020-07-24 00:42:17 +09:00
peaceiris
b15488f0b3 chore(release): Add build assets 2020-07-24 00:42:15 +09:00
peaceiris
612f1f7579 fix: chdir to workDir after copied assets
Related to #324
2020-07-24 00:40:01 +09:00
dependabot[bot]
af7aac1007 ci: bump codecov/codecov-action from v1.0.11 to v1.0.12 (#409)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.0.11 to v1.0.12.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Commits](https://github.com/codecov/codecov-action/compare/v1.0.11...07127fde53bc3ccd346d47ab2f14c390161ad108)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-23 14:28:01 +09:00
peaceiris
6896bd8b80 docs: change default-branch to main 2020-07-23 12:17:19 +09:00
Shohei Ueda
ad558aa8bd docs: bump hugo from 0.71.1 to 0.74.2 2020-07-23 12:12:27 +09:00
Shohei Ueda
5051105279 docs: change master branch to default-branch (#408) 2020-07-23 12:10:40 +09:00
Shohei Ueda
99a89f661a docs: Add Code Scanning workflow badge 2020-07-23 11:22:23 +09:00
dependabot[bot]
8cd820bd66 ci: bump actions/setup-node from v2.1.0 to v2.1.1 (#407)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.1.0 to v2.1.1.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.1.0...321b6ccb03083caa2ad22b27dc4b45335212e824)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-22 14:42:08 +09:00
Shohei Ueda
f633b0f6b5 ci: remove types [skip ci] 2020-07-21 19:44:14 +09:00
Shohei Ueda
a2712f7b92 ci: Add docker-compose.yml (#406) 2020-07-21 19:37:23 +09:00
peaceiris
09b03c0bb1 chore(release): Remove build assets [skip ci] 2020-07-21 12:53:50 +09:00
16 changed files with 193 additions and 83 deletions

View File

@@ -10,16 +10,15 @@ on:
- '.nvmrc'
- 'Dockerfile'
- 'Makefile'
- 'docker-compose.yml'
pull_request:
types:
- opened
- synchronize
paths:
- '.github/workflows/dev-image.yml'
- '.dockerignore'
- '.nvmrc'
- 'Dockerfile'
- 'Makefile'
- 'docker-compose.yml'
jobs:
skipci:
@@ -34,10 +33,10 @@ jobs:
- uses: actions/checkout@v2.3.1
- name: Login to Packages
run: echo '${{ secrets.GITHUB_TOKEN }}' | docker login 'docker.pkg.github.com' -u 'peaceiris' --password-stdin
- run: make pull
- run: docker-compose pull --quiet
if: github.event_name == 'pull_request'
- run: make build
- run: make cirun cmd="npm ci"
- run: make ciall
- run: make push
- run: make ci
- run: make all
- run: docker-compose push
if: github.ref == 'refs/heads/main'

View File

@@ -34,7 +34,7 @@ jobs:
id: nvm
- name: Setup Node
uses: actions/setup-node@v2.1.0
uses: actions/setup-node@v2.1.1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
@@ -64,7 +64,7 @@ jobs:
name: coverage-${{ matrix.os }}
path: coverage
- uses: codecov/codecov-action@v1.0.11
- uses: codecov/codecov-action@v1.0.12
with:
token: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -2,6 +2,74 @@
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-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)
### fix
* copyAssets() for destination_dir (#414) ([674c231](https://github.com/peaceiris/actions-gh-pages/commit/674c2318cebb9ba59aa8fbf8ec4fae8482e51e5c)), closes [#414](https://github.com/peaceiris/actions-gh-pages/issues/414)
# [3.7.0-3](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-2...v3.7.0-3) (2020-07-24)
### deps
* bump @types/jest from 26.0.5 to 26.0.7 (#411) ([d1700b5](https://github.com/peaceiris/actions-gh-pages/commit/d1700b565361478232daa6d66d3fe7c146b9d08f)), closes [#411](https://github.com/peaceiris/actions-gh-pages/issues/411)
* bump @types/node from 12.12.51 to 12.12.52 (#412) ([1b5d710](https://github.com/peaceiris/actions-gh-pages/commit/1b5d710b249d09c1e229931378217c47773de8ed)), closes [#412](https://github.com/peaceiris/actions-gh-pages/issues/412)
### fix
* set full path of publishing assets (#413) ([6f6bb26](https://github.com/peaceiris/actions-gh-pages/commit/6f6bb2661a12d5db5d7df62962d1d28403a02860)), closes [#413](https://github.com/peaceiris/actions-gh-pages/issues/413) [/github.com/peaceiris/actions-gh-pages/issues/410#issuecomment-663507581](https://github.com//github.com/peaceiris/actions-gh-pages/issues/410/issues/issuecomment-663507581)
### refactor
* change message type from warning to info ([3667feb](https://github.com/peaceiris/actions-gh-pages/commit/3667febec573a36efa26505b6a712b314242991a))
# [3.7.0-2](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-1...v3.7.0-2) (2020-07-23)
### ci
* Add docker-compose.yml (#406) ([a2712f7](https://github.com/peaceiris/actions-gh-pages/commit/a2712f7b923e3e05d0f46e54fbcacef3380aca31)), closes [#406](https://github.com/peaceiris/actions-gh-pages/issues/406)
* bump actions/setup-node from v2.1.0 to v2.1.1 (#407) ([8cd820b](https://github.com/peaceiris/actions-gh-pages/commit/8cd820bd660be6aa016923b6b35005df2fb071da)), closes [#407](https://github.com/peaceiris/actions-gh-pages/issues/407)
* bump codecov/codecov-action from v1.0.11 to v1.0.12 (#409) ([af7aac1](https://github.com/peaceiris/actions-gh-pages/commit/af7aac10073791e2907990204f723d6b0ff902c5)), closes [#409](https://github.com/peaceiris/actions-gh-pages/issues/409)
* remove types [skip ci] ([f633b0f](https://github.com/peaceiris/actions-gh-pages/commit/f633b0f6b54f252348cc3b10713b111caaf6f3d1))
### docs
* Add Code Scanning workflow badge ([99a89f6](https://github.com/peaceiris/actions-gh-pages/commit/99a89f661a291c444965018bf828995e08d7bb7b))
* bump hugo from 0.71.1 to 0.74.2 ([ad558aa](https://github.com/peaceiris/actions-gh-pages/commit/ad558aa8bd9ad82edc7bd886159659328e6d61de))
* change default-branch to main ([6896bd8](https://github.com/peaceiris/actions-gh-pages/commit/6896bd8b80ecc02e6c47bbcf7fc1ae0bd4d47645))
* change master branch to default-branch (#408) ([5051105](https://github.com/peaceiris/actions-gh-pages/commit/505110527986e8c3d30694488f643d6529d0d593)), closes [#408](https://github.com/peaceiris/actions-gh-pages/issues/408)
### fix
* chdir to workDir after copied assets ([612f1f7](https://github.com/peaceiris/actions-gh-pages/commit/612f1f7579820dc380d265d61924f7a7d8718859)), closes [#324](https://github.com/peaceiris/actions-gh-pages/issues/324)
# [3.7.0-1](https://github.com/peaceiris/actions-gh-pages/compare/v3.7.0-0...v3.7.0-1) (2020-07-21)

View File

@@ -1,46 +1,22 @@
cmd := "bash"
msg := ""
IMAGE_NAME := docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest
NODE_VERSION := $(shell cat ./.nvmrc)
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
.PHONY: build
build:
docker build . \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--cache-from=${IMAGE_NAME} \
-t $(IMAGE_NAME)
.PHONY: pull
pull:
docker pull ${IMAGE_NAME}
.PHONY: push
push:
docker push ${IMAGE_NAME}
docker-compose build --build-arg NODE_VERSION=$(NODE_VERSION)
.PHONY: run
run:
$(DOCKER_RUN) $(cmd)
docker-compose run --rm dev bash
.PHONY: cirun
cirun:
$(DOCKER_RUN_CI) $(cmd)
.PHONY: ci
ci:
docker-compose run --rm -T dev npm ci
.PHONY: test
test:
$(DOCKER_RUN) npm test
.PHONY: commit
commit:
$(DOCKER_RUN) git commit -m "$(msg)"
docker-compose run --rm -T dev npm test
.PHONY: all
all:
$(DOCKER_RUN) npm run all
.PHONY: ciall
ciall:
$(DOCKER_RUN_CI) npm run all
docker-compose run --rm -T dev npm run all

View File

@@ -2,6 +2,7 @@
[![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)
![Test](https://github.com/peaceiris/actions-gh-pages/workflows/Test/badge.svg?branch=main&event=push)
![Code Scanning](https://github.com/peaceiris/actions-gh-pages/workflows/Code%20Scanning/badge.svg?event=push)
[![CodeFactor](https://www.codefactor.io/repository/github/peaceiris/actions-gh-pages/badge)](https://www.codefactor.io/repository/github/peaceiris/actions-gh-pages)
<img width="400" alt="GitHub Actions for deploying to GitHub Pages with Static Site Generators" src="./images/ogp.svg">
@@ -112,7 +113,7 @@ All Actions runners: Linux (Ubuntu), macOS, and Windows are supported.
### ⭐️ Repository type - Project
Add your workflow file `.github/workflows/gh-pages.yml` and push to the remote master branch.
Add your workflow file `.github/workflows/gh-pages.yml` and push to the remote default branch branch.
An example workflow for Hugo.
@@ -126,7 +127,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -140,7 +141,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.71.1'
hugo-version: '0.74.2'
- name: Build
run: hugo --minify
@@ -445,7 +446,7 @@ name: github pages
on:
push:
branches:
- master
- main
tags:
- 'v*.*.*'
@@ -477,7 +478,7 @@ jobs:
Commands on a local machine.
```console
$ # On the master branch
$ # On a main branch
$ git tag -a "v1.2.3" -m "Release v1.2.3"
$ git push origin "v1.2.3"
@@ -485,7 +486,7 @@ $ # After deployment
$ git fetch origin
$ git tag
deploy-v1.2.3 # Tag on the gh-pages branch
v1.2.3 # Tag on the master branch
v1.2.3 # Tag on the main branch
```
<div align="right">
@@ -571,7 +572,7 @@ name: github pages
on:
push:
branches:
- master
- main
schedule:
- cron: "22 22 * * *"
workflow_dispatch:
@@ -608,7 +609,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -652,7 +653,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -700,7 +701,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -751,7 +752,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -797,7 +798,7 @@ name: github pages
on:
push:
branches:
- master
- main
paths:
- '.github/workflows/deploy.yml'
- 'website/**'
@@ -854,7 +855,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -910,7 +911,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -945,7 +946,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -985,7 +986,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -1061,7 +1062,7 @@ name: GitHub Pages
on:
push:
branches:
- master
- main
jobs:
deploy:

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

@@ -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'

16
docker-compose.yml Normal file
View File

@@ -0,0 +1,16 @@
version: '3.2'
services:
dev:
image: 'docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest'
build:
context: .
cache_from:
- 'docker.pkg.github.com/peaceiris/actions-gh-pages/dev:latest'
container_name: peaceiris_actions_github_pages
volumes:
- ${PWD}:/repo
stdin_open: true
tty: true
command:
- bash

File diff suppressed because one or more lines are too long

31
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.7.0-1",
"version": "3.7.0-6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -28,6 +28,15 @@
"@octokit/plugin-rest-endpoint-methods": "^4.0.0"
}
},
"@actions/glob": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
"integrity": "sha512-lx8SzyQ2FE9+UUvjqY1f28QbTJv+w8qP7kHHbfQRhphrlcx0Mdmm1tZdGJzfxv1jxREa/sLW4Oy8CbGQKCJySA==",
"requires": {
"@actions/core": "^1.2.0",
"minimatch": "^3.0.4"
}
},
"@actions/http-client": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.8.tgz",
@@ -997,9 +1006,9 @@
}
},
"@types/jest": {
"version": "26.0.5",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.5.tgz",
"integrity": "sha512-heU+7w8snfwfjtcj2H458aTx3m5unIToOJhx75ebHilBiiQ39OIdA18WkG4LP08YKeAoWAGvWg8s+22w/PeJ6w==",
"version": "26.0.7",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.7.tgz",
"integrity": "sha512-+x0077/LoN6MjqBcVOe1y9dpryWnfDZ+Xfo3EqGeBcfPRJlQp3Lw62RvNlWxuGv7kOEwlHriAa54updi3Jvvwg==",
"dev": true,
"requires": {
"jest-diff": "^25.2.1",
@@ -1025,9 +1034,9 @@
"dev": true
},
"@types/node": {
"version": "12.12.51",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.51.tgz",
"integrity": "sha512-6ILqt8iNThALrxDv2Q4LyYFQxULQz96HKNIFd4s9QRQaiHINYeUpLqeU/2IU7YMtvipG1fQVAy//vY8/fX1Y9w=="
"version": "12.12.52",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.52.tgz",
"integrity": "sha512-oNJSI5bzuAH4f4I5JatPf4jytM6vQPWMw8JDOH68mNMyOmSqBkctHBfsyaBU3Su+dhYd8E+tDtPJWUXsyO5Msg=="
},
"@types/normalize-package-data": {
"version": "2.4.0",
@@ -1560,8 +1569,7 @@
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"base": {
"version": "0.11.2",
@@ -1642,7 +1650,6 @@
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@@ -1967,8 +1974,7 @@
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "2.0.0",
@@ -6752,7 +6758,6 @@
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}

View File

@@ -1,6 +1,6 @@
{
"name": "actions-github-pages",
"version": "3.7.0-1",
"version": "3.7.0-6",
"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.5",
"@types/jest": "^26.0.7",
"@types/js-yaml": "^3.12.4",
"@types/node": "~12",
"@typescript-eslint/eslint-plugin": "^2.34.0",

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,19 +13,50 @@ 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()) {
io.rmRF(asset);
core.info(`[INFO] delete ${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 filePath = path.join(publishDir, file);
await io.cp(filePath, `${destDir}/`, copyOpts);
const filePublishPath = path.join(publishDir, file);
const fileDestPath = path.join(destDir, file);
const destPath = path.dirname(fileDestPath);
if (fs.existsSync(destPath) === false) {
await createDir(destPath);
}
await io.cp(filePublishPath, fileDestPath, copyOpts);
core.info(`[INFO] copy ${file}`);
}
await deleteExcludedAssets(destDir, excludeAssets);
return;
}
@@ -49,8 +81,7 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
await createDir(destDir);
process.chdir(workDir);
await createBranchForce(inps.PublishBranch);
process.chdir(destDir);
await copyAssets(publishDir, destDir);
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
return;
}
@@ -92,7 +123,8 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
}
}
await copyAssets(publishDir, destDir);
await copyAssets(publishDir, destDir, inps.ExcludeAssets);
process.chdir(workDir);
return;
} else {
throw new Error(`Failed to clone remote branch ${inps.PublishBranch}`);
@@ -103,7 +135,7 @@ export async function setRepo(inps: Inputs, remoteURL: string, workDir: string):
await createDir(destDir);
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

@@ -53,7 +53,7 @@ export async function addCNAME(workDir: string, content: string): Promise<void>
}
const filepath = path.join(workDir, 'CNAME');
if (fs.existsSync(filepath)) {
core.warning(`CNAME already exists, skip adding CNAME`);
core.info(`CNAME already exists, skip adding CNAME`);
return;
}
fs.writeFileSync(filepath, content + '\n');