Compare commits

..

37 Commits

Author SHA1 Message Date
peaceiris
92ca1cb5bb chore(release): 2.4.0 2020-01-18 01:59:40 +09:00
peaceiris
1b689687f3 chore(release): Add build assets 2020-01-18 01:59:39 +09:00
peaceiris
76e22f1114 docs: Reindent [skip ci] 2020-01-18 01:56:05 +09:00
peaceiris
490ab9b0a4 docs: Add back to TOC link 2020-01-18 01:54:59 +09:00
peaceiris
3d1e811264 docs: Add new sections 2020-01-18 01:50:49 +09:00
peaceiris
6a39a0f0e5 docs: Bump Hugo version v0.62.2 2020-01-18 01:46:42 +09:00
peaceiris
fbf2ba3b8b ci: Add [skip ci] 2020-01-18 01:40:52 +09:00
peaceiris
9d8553d36d ci: Add release workflow [skip ci] 2020-01-18 01:40:06 +09:00
peaceiris
7d9bfa0c1d ci: Enhance tag creation 2020-01-18 01:39:09 +09:00
peaceiris
5ce129c278 chore: Add .DS_Store [skip ci] 2020-01-18 01:12:59 +09:00
peaceiris
7496c44053 test: Add Docker container for testing [skip ci] 2020-01-18 01:10:09 +09:00
peaceiris
dc9576430f chore: Add standard-version [skip ci] 2020-01-18 01:07:24 +09:00
peaceiris
3b68672699 chore: Remove .gitattributes [skip ci] 2020-01-18 00:55:20 +09:00
Shohei Ueda
6a7231ef83 deps: update (#126) 2020-01-18 00:52:59 +09:00
Shohei Ueda
4331a62207 chore: Add task to autorun npm ci [skip ci] (#128) 2020-01-18 00:52:16 +09:00
Shohei Ueda
7dc067063b chore: Disable branch execution (#125) 2020-01-18 00:44:07 +09:00
Shohei Ueda
57168bc2bc chore: Update LICENSE year 2020-01-16 17:42:37 +09:00
Shohei Ueda
cca78d865e deps: upgrade node v12.14.1 (#119) 2020-01-10 10:20:50 +09:00
Shohei Ueda
bad8e7f80f deps: update (#118) 2020-01-10 10:16:11 +09:00
Shohei Ueda
ca3c62d21c feat: update deps (#110) 2019-12-23 17:40:26 +09:00
Shohei Ueda
25520f73cd feat: update node 12.14.0 (#105) 2019-12-19 04:20:34 +09:00
Shohei Ueda
5e6d8b50e2 feat: update deps (#104) 2019-12-18 07:08:02 +09:00
peaceiris
d006b81d18 docs: update hugo-version to v0.61.0 2019-12-18 07:04:13 +09:00
peaceiris
1fa5fb2f2e docs: add link to peaceiris/hugo-extended-docker 2019-12-18 07:01:35 +09:00
Shohei Ueda
f21cef4446 chore: fix tag push 2019-12-14 21:27:59 +09:00
peaceiris
754a1d28dd chore: Add .gitattributes 2019-12-14 19:38:51 +09:00
peaceiris
ae65d5c8e9 2.3.2 2019-12-14 18:46:47 +09:00
Shohei Ueda
10f36c7c91 feat: update deps (#103) 2019-12-14 17:59:17 +09:00
Shohei Ueda
236e039b5f chore: update actions/checkout to v2 2019-12-14 17:46:47 +09:00
Shohei Ueda
2f904a6aa6 chore: enhance workflow 2019-12-14 17:42:59 +09:00
Shohei Ueda
2b3acb31e4 chore: Add message 2019-12-10 13:50:09 +09:00
Shohei Ueda
f14d276121 chore: Enhance syntax 2019-12-09 18:58:26 +09:00
Shohei Ueda
9eb8f9e108 Update purge-readme-image-cache.yml 2019-12-09 10:38:30 +09:00
peaceiris
69200f8579 gha: Remove push trigger 2019-12-08 17:46:26 +09:00
peaceiris
3cf50c6d11 gha: Add push trigger 2019-12-08 17:45:29 +09:00
peaceiris
900499cd1c gha: Remove push trigger 2019-12-08 17:27:29 +09:00
peaceiris
da7c321b3b gha: Add workflow to purge readme image cache 2019-12-08 17:21:16 +09:00
16 changed files with 2533 additions and 981 deletions

7
.dockerignore Normal file
View File

@@ -0,0 +1,7 @@
.*
!.eslintrc.json
!.prettierrc.json
coverage
node_modules

View File

@@ -0,0 +1,16 @@
name: Purge image cache
on:
schedule:
- cron: '4 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 %

43
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,43 @@
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"
- name: Install hub
run: |
HUB_VERSION="2.13.0"
HUB_NAME="hub-linux-amd64-${HUB_VERSION}"
HUB_TARBALL="${HUB_NAME}.tgz"
wget -q "https://github.com/github/hub/releases/download/v${HUB_VERSION}/${HUB_TARBALL}"
tar -zxvf "./${HUB_TARBALL}"
mkdir ~/bin
cp "./${HUB_NAME}/bin/hub" ~/bin/
echo "::add-path::~/bin/"
rm -rf "./${HUB_NAME}" "./${HUB_TARBALL}"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md
sed -i "1iRelease ${TAG_NAME}\n" ./release_notes.md
hub release create \
--draft \
--prerelease \
--file ./release_notes.md \
"${TAG_NAME}"

View File

@@ -1,78 +1,89 @@
name: 'Test'
on:
pull_request:
types: [opened, synchronize]
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'
branches:
- master
- master
paths-ignore:
- '**.md'
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '**.md'
jobs:
test:
skipci:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Cache
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 format:check
- run: npm run lint
- run: npm test
- name: Check ncc
run: |
npm run build
test -z "$(git status --short)"
- name: Upload test coverage
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage
test-prod:
test:
runs-on: ${{ matrix.os }}
needs: test
if: contains(github.event.head_commit.message, '[skip ci]') == false
strategy:
matrix:
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
hugo-version: ['latest', '0.57.2']
extended: [true, false]
os:
- 'ubuntu-18.04'
- 'macos-latest'
- 'windows-latest'
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Test action
uses: ./
with:
hugo-version: ${{ matrix.hugo-version }}
extended: ${{ matrix.extended }}
- uses: actions/checkout@v2
- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- name: Run prettier
if: startsWith(matrix.os, 'ubuntu')
run: npm run format:check
- name: Run eslint
if: startsWith(matrix.os, 'ubuntu')
run: npm run lint
- name: Run ncc
if: startsWith(matrix.os, 'ubuntu')
run: npm run build
- run: npm test
- name: Upload test coverage as artifact
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage
# - name: Upload test coverage to Coveralls
# uses: coverallsapp/github-action@v1.0.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel: true
#
# - name: Coveralls Finished
# uses: coverallsapp/github-action@v1.0.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# parallel-finished: true

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Update major tag
if: github.event.release.prerelease == false
@@ -19,6 +19,5 @@ jobs:
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}" || git tag -d "${TAG_MAJOR}" ; git push origin ":refs/tags/${TAG_MAJOR}"
git tag "${TAG_MAJOR}" || true
git push --tags origin
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
git push --force origin "${TAG_MAJOR}"

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
.DS_Store
coverage
.npm
.eslintcache

2
.nvmrc
View File

@@ -1 +1 @@
12.13.0
12.14.1

54
CHANGELOG.md Normal file
View File

@@ -0,0 +1,54 @@
# Changelog
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.
# [2.4.0](https://github.com/peaceiris/actions-hugo/compare/v2.3.2...v2.4.0) (2020-01-17)
### chore
* Add .DS_Store [skip ci] ([5ce129c](https://github.com/peaceiris/actions-hugo/commit/5ce129c278027bbd0b3d4fb967ea86543f719c7a))
* Add .gitattributes ([754a1d2](https://github.com/peaceiris/actions-hugo/commit/754a1d28dd8649e5a1151164c990298f36a093d4))
* Add standard-version [skip ci] ([dc95764](https://github.com/peaceiris/actions-hugo/commit/dc9576430f57dfabaa663af12d5dcd1210c1b155))
* Add task to autorun npm ci [skip ci] (#128) ([4331a62](https://github.com/peaceiris/actions-hugo/commit/4331a62207ee1604966b28fa32ba5d1ae1b30c6a)), closes [#128](https://github.com/peaceiris/actions-hugo/issues/128)
* Disable branch execution (#125) ([7dc0670](https://github.com/peaceiris/actions-hugo/commit/7dc067063bb67b1e59949161e3be905ed40e3c31)), closes [#125](https://github.com/peaceiris/actions-hugo/issues/125)
* fix tag push ([f21cef4](https://github.com/peaceiris/actions-hugo/commit/f21cef4446db8a2c47e78208d14acc25c3f5cf51))
* Remove .gitattributes [skip ci] ([3b68672](https://github.com/peaceiris/actions-hugo/commit/3b6867269979eef7d5bdd6de65470678a7e33604))
* Update LICENSE year ([57168bc](https://github.com/peaceiris/actions-hugo/commit/57168bc2bc3981bfabde15282e9c81dd9f5300ac))
### ci
* Add [skip ci] ([fbf2ba3](https://github.com/peaceiris/actions-hugo/commit/fbf2ba3b8ba09038d81bcd17fe9dfe0e4d7190ff))
* Add release workflow [skip ci] ([9d8553d](https://github.com/peaceiris/actions-hugo/commit/9d8553d36d52e040d2bcdd9092544fe6df5bcb91))
* Enhance tag creation ([7d9bfa0](https://github.com/peaceiris/actions-hugo/commit/7d9bfa0c1d5a9fe98246cf06033890d624a717f0))
### deps
* update (#118) ([bad8e7f](https://github.com/peaceiris/actions-hugo/commit/bad8e7f80f8fb90e4fc8297535d1c5c8102240d4)), closes [#118](https://github.com/peaceiris/actions-hugo/issues/118)
* update (#126) ([6a7231e](https://github.com/peaceiris/actions-hugo/commit/6a7231ef834e01c9eb84b15f1432d42804f7c69a)), closes [#126](https://github.com/peaceiris/actions-hugo/issues/126)
* upgrade node v12.14.1 (#119) ([cca78d8](https://github.com/peaceiris/actions-hugo/commit/cca78d865e24a18ed38b19dfc4bf0c7130c4c232)), closes [#119](https://github.com/peaceiris/actions-hugo/issues/119)
### docs
* Add back to TOC link ([490ab9b](https://github.com/peaceiris/actions-hugo/commit/490ab9b0a4d95458b58203661788d6499f27d573))
* add link to peaceiris/hugo-extended-docker ([1fa5fb2](https://github.com/peaceiris/actions-hugo/commit/1fa5fb2f2eda35bda254f126aa066972de95cfbd))
* Add new sections ([3d1e811](https://github.com/peaceiris/actions-hugo/commit/3d1e8112641c5fafdd12e5e4cf4f359ac289ce71))
* Bump Hugo version v0.62.2 ([6a39a0f](https://github.com/peaceiris/actions-hugo/commit/6a39a0f0e57bc115c411920fe91ae0144ff26b7e))
* Reindent [skip ci] ([76e22f1](https://github.com/peaceiris/actions-hugo/commit/76e22f1114f4fdfe2db25ff96bf65b4c513a942c))
* update hugo-version to v0.61.0 ([d006b81](https://github.com/peaceiris/actions-hugo/commit/d006b81d1845f59bb755a221aff0b61bbff15375))
### feat
* update deps (#104) ([5e6d8b5](https://github.com/peaceiris/actions-hugo/commit/5e6d8b50e242b4f27b9794f002a74032f4abb8f1)), closes [#104](https://github.com/peaceiris/actions-hugo/issues/104)
* update deps (#110) ([ca3c62d](https://github.com/peaceiris/actions-hugo/commit/ca3c62d21c77504550e4eba47456f9001d2c64ab)), closes [#110](https://github.com/peaceiris/actions-hugo/issues/110)
* update node 12.14.0 (#105) ([25520f7](https://github.com/peaceiris/actions-hugo/commit/25520f73cde6077d55cce09381b4121d83264fff)), closes [#105](https://github.com/peaceiris/actions-hugo/issues/105)
### test
* Add Docker container for testing [skip ci] ([7496c44](https://github.com/peaceiris/actions-hugo/commit/7496c44053ad339cde271140b13a6c3e5385f596))
# Changelog
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.

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2019 Shohei Ueda (peaceiris)
Copyright (c) 2020 Shohei Ueda (peaceiris)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

22
Makefile Normal file
View File

@@ -0,0 +1,22 @@
cmd := "bash"
msg := ""
IMAGE_NAME := actions-hugo-dev:latest
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --file ./__tests__/Dockerfile
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/etc/gitconfig $(IMAGE_NAME)
.PHONY: build
build:
$(DOCKER_BUILD)
.PHONY: run
run:
$(DOCKER_RUN) $(cmd)
.PHONY: test
test:
$(DOCKER_RUN) npm test
.PHONY: commit
commit:
$(DOCKER_RUN) git commit -m "$(msg)"

View File

@@ -39,8 +39,10 @@ From `v2`, this Hugo action migrated to a JavaScript (TypeScript) action. We no
- [⭐️ Use the latest version of Hugo](#%EF%B8%8F-use-the-latest-version-of-hugo)
- [Tips](#tips)
- [⭐️ Read Hugo version from file](#%EF%B8%8F-read-hugo-version-from-file)
- [CHANGELOG](#changelog)
- [License](#license)
- [About the author](#about-the-author)
- [About Maintainer](#about-maintainer)
- [Maintainer Notes](#maintainer-notes)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
@@ -65,31 +67,31 @@ name: github pages
on:
push:
branches:
- master
- master
jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
# with:
# submodules: true
- uses: actions/checkout@v1
# with:
# submodules: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.59.1'
# extended: true
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.62.2'
# extended: true
- name: Build
run: hugo --minify
- name: Build
run: hugo --minify
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
- name: Deploy
uses: peaceiris/actions-gh-pages@v2
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./public
```
<div align="right">
@@ -108,7 +110,7 @@ Set `extended: true` to use a Hugo extended version.
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.59.1'
hugo-version: '0.62.2'
extended: true
```
@@ -140,7 +142,7 @@ How to sync a Hugo version between a Docker Compose and a GitHub Actions workflo
Write a `HUGO_VERSION` to the `.env` file like the following and push it to a remote branch.
```sh
HUGO_VERSION=0.59.1
HUGO_VERSION=0.62.2
```
Next, add a step to read a Hugo version from the `.env` file.
@@ -179,6 +181,20 @@ services:
- --buildDrafts
```
The alpine base Hugo Docker image is provided on the following repository.
> [peaceiris/hugo-extended-docker: Hugo alpine base Docker image (Hugo extended and Hugo Modules)](https://github.com/peaceiris/hugo-extended-docker)
<div align="right">
<a href="#table-of-contents">Back to TOC ☝️</a>
</div>
## CHANGELOG
- [CHANGELOG.md](CHANGELOG.md)
## License
@@ -189,9 +205,29 @@ services:
## About the author
## About Maintainer
- [peaceiris's homepage](https://peaceiris.com/)
- [peaceiris homepage](https://peaceiris.com/)
## Maintainer Notes
Run `npm` and `git commit` commands on a container.
**On Host**
```sh
# Docker
make build
make run
make run cmd="env"
make test
make commit msg="chore: Add Makefile"
# Release
./release.sh
```

11
__tests__/Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM node:12-slim
WORKDIR /repo
RUN apt-get update && \
apt-get -y install --no-install-recommends \
git \
bash && \
rm -rf /var/lib/apt/lists/*
CMD [ "bash" ]

File diff suppressed because it is too large Load Diff

1807
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "hugo-action",
"version": "2.2.0",
"version": "2.4.0",
"description": "Hugo setup action",
"main": "lib/index.js",
"scripts": {
@@ -10,13 +10,15 @@
"build": "ncc build ./src/index.ts -o lib",
"tsc": "tsc",
"format": "prettier --write **/*.ts",
"format:check": "prettier --check **/*.ts"
"format:check": "prettier --check **/*.ts",
"release": "standard-version",
"update-deps": "(git diff 'HEAD@{1}' --name-only | grep 'package-lock.json' > /dev/null) && npm ci || :"
},
"husky": {
"skipCI": true,
"hooks": {
"pre-commit": "lint-staged",
"post-commit": "npm run build && echo '⚠️ Do not forget to Commit and Push ./lib/index.js'"
"post-merge": "npm run update-deps; git remote prune origin"
}
},
"lint-staged": {
@@ -46,24 +48,25 @@
},
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
"dependencies": {
"@actions/core": "^1.2.0",
"@actions/exec": "^1.0.1",
"@actions/io": "^1.0.1",
"@actions/tool-cache": "^1.1.2",
"@actions/core": "^1.2.1",
"@actions/exec": "^1.0.3",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.3.0",
"xmlhttprequest": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^24.0.23",
"@types/node": "^12.12.14",
"@typescript-eslint/parser": "^2.10.0",
"@zeit/ncc": "^0.20.5",
"eslint": "^6.7.2",
"husky": "^3.1.0",
"@types/jest": "^24.9.0",
"@types/node": "^13.1.7",
"@typescript-eslint/parser": "^2.16.0",
"@zeit/ncc": "^0.21.0",
"eslint": "^6.8.0",
"husky": "^4.0.10",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
"lint-staged": "^9.5.0",
"prettier": "1.19.1",
"ts-jest": "^24.2.0",
"typescript": "^3.7.3"
"standard-version": "^7.0.1",
"ts-jest": "^24.3.0",
"typescript": "^3.7.5"
}
}

48
release.sh Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# fail on unset variables and command errors
set -eu -o pipefail # -x: is for debugging
if [ "$(git branch --show-current)" != "master" ]; then
echo "$0: Current branch is not master" 1>&2
exit 1
fi
RELEASE_TYPE_LIST="prerelease prepatch patch preminor minor major premajor"
if command -v fzf; then
RELEASE_TYPE=$(echo "${RELEASE_TYPE_LIST}" | tr ' ' '\n' | fzf --layout=reverse)
else
select sel in ${RELEASE_TYPE_LIST}; do
RELEASE_TYPE="${sel}"
break
done
fi
echo "$0: Create ${RELEASE_TYPE} release, continue? (y/n)"
read -r res
if [ "${res}" = "n" ]; then
echo "$0: Stop script"
exit 0
fi
git fetch origin
git pull origin master
git tag -d v2
git pull origin --tags
npm ci
mkdir ./lib
npm run build
git add ./lib/index.js
git commit -m "chore(release): Add build assets"
npm run release -- --release-as "${RELEASE_TYPE}" --preset eslint
git rm ./lib/index.js
rm -rf ./lib
git commit -m "chore(release): Remove build assets [skip ci]"
TAG_NAME="v$(jq -r '.version' ./package.json)"
git push origin master
git push origin "${TAG_NAME}"