mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 12:22:17 +01:00
Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92ca1cb5bb | ||
|
|
1b689687f3 | ||
|
|
76e22f1114 | ||
|
|
490ab9b0a4 | ||
|
|
3d1e811264 | ||
|
|
6a39a0f0e5 | ||
|
|
fbf2ba3b8b | ||
|
|
9d8553d36d | ||
|
|
7d9bfa0c1d | ||
|
|
5ce129c278 | ||
|
|
7496c44053 | ||
|
|
dc9576430f | ||
|
|
3b68672699 | ||
|
|
6a7231ef83 | ||
|
|
4331a62207 | ||
|
|
7dc067063b | ||
|
|
57168bc2bc | ||
|
|
cca78d865e | ||
|
|
bad8e7f80f | ||
|
|
ca3c62d21c | ||
|
|
25520f73cd | ||
|
|
5e6d8b50e2 | ||
|
|
d006b81d18 | ||
|
|
1fa5fb2f2e | ||
|
|
f21cef4446 | ||
|
|
754a1d28dd | ||
|
|
ae65d5c8e9 | ||
|
|
10f36c7c91 | ||
|
|
236e039b5f | ||
|
|
2f904a6aa6 | ||
|
|
2b3acb31e4 | ||
|
|
f14d276121 | ||
|
|
9eb8f9e108 | ||
|
|
69200f8579 | ||
|
|
3cf50c6d11 | ||
|
|
900499cd1c | ||
|
|
da7c321b3b | ||
|
|
739a95f1e7 | ||
|
|
bc6f48c683 | ||
|
|
cf07920706 | ||
|
|
3e0ab3eb25 | ||
|
|
c5ea31b9d7 | ||
|
|
bc06efb2e0 | ||
|
|
3b3c59db47 | ||
|
|
b51e0ae5b4 | ||
|
|
8b813b0c62 | ||
|
|
638f751056 | ||
|
|
d04830441a | ||
|
|
5dc353210f | ||
|
|
129fcc86a6 |
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
.*
|
||||||
|
|
||||||
|
!.eslintrc.json
|
||||||
|
!.prettierrc.json
|
||||||
|
|
||||||
|
coverage
|
||||||
|
node_modules
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
---
|
---
|
||||||
name: Feature request
|
name: Proposal
|
||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
title: 'feat: This is a sample title'
|
title: 'proposal: This is a sample title'
|
||||||
labels: request
|
labels: proposal
|
||||||
assignees: peaceiris
|
assignees: peaceiris
|
||||||
|
|
||||||
---
|
---
|
||||||
16
.github/workflows/purge-readme-image-cache.yml
vendored
Normal file
16
.github/workflows/purge-readme-image-cache.yml
vendored
Normal 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
43
.github/workflows/release.yml
vendored
Normal 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}"
|
||||||
17
.github/workflows/stale.yml
vendored
Normal file
17
.github/workflows/stale.yml
vendored
Normal 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
|
||||||
132
.github/workflows/test.yml
vendored
132
.github/workflows/test.yml
vendored
@@ -1,73 +1,89 @@
|
|||||||
name: 'Test'
|
name: 'Test'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize]
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
push:
|
push:
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
skipci:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Read .nvmrc
|
test:
|
||||||
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.0.1
|
|
||||||
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: Upload test coverage
|
|
||||||
uses: actions/upload-artifact@master
|
|
||||||
with:
|
|
||||||
name: coverage
|
|
||||||
path: coverage
|
|
||||||
|
|
||||||
|
|
||||||
test-prod:
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: test
|
if: contains(github.event.head_commit.message, '[skip ci]') == false
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: ['ubuntu-18.04', 'macos-latest', 'windows-latest']
|
os:
|
||||||
hugo-version: ['latest', '0.57.2']
|
- 'ubuntu-18.04'
|
||||||
extended: [true, false]
|
- 'macos-latest'
|
||||||
|
- 'windows-latest'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
|
||||||
with:
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Test action
|
- uses: actions/checkout@v2
|
||||||
uses: ./
|
|
||||||
with:
|
- name: Read .nvmrc
|
||||||
hugo-version: ${{ matrix.hugo-version }}
|
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
|
||||||
extended: ${{ matrix.extended }}
|
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
|
||||||
|
|||||||
23
.github/workflows/update-major-tag.yml
vendored
Normal file
23
.github/workflows/update-major-tag.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
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 --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
|
||||||
|
git push --force origin "${TAG_MAJOR}"
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
.DS_Store
|
||||||
coverage
|
coverage
|
||||||
.npm
|
.npm
|
||||||
.eslintcache
|
.eslintcache
|
||||||
|
|||||||
54
CHANGELOG.md
Normal file
54
CHANGELOG.md
Normal 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.
|
||||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
22
Makefile
Normal file
22
Makefile
Normal 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)"
|
||||||
90
README.md
90
README.md
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
We can run **Hugo** on a virtual machine of **GitHub Actions** by this Hugo action. **Hugo extended** version and **Hugo Modules** are supported.
|
We can run **Hugo** on a virtual machine of **GitHub Actions** by this Hugo action. **Hugo extended** version and **Hugo Modules** are supported.
|
||||||
|
|
||||||
From `v2.0.0`, this Hugo action migrated to a JavaScript (TypeScript) action. We no longer build or pull a Hugo docker image. Thanks to this change, we can complete this action less than **4 sec**. (A docker base action was taking about 1 min or more execution time to build or pull.)
|
From `v2`, this Hugo action migrated to a JavaScript (TypeScript) action. We no longer build or pull a Hugo docker image. Thanks to this change, we can complete this action less than **4 sec**. (A docker base action was taking about 1 min or more execution time to build or pull.)
|
||||||
|
|
||||||
| OS (runs-on) | ubuntu-18.04 | macos-latest | windows-2019 |
|
| OS (runs-on) | ubuntu-18.04 | macos-latest | windows-2019 |
|
||||||
|---|:---:|:---:|:---:|
|
|---|:---:|:---:|:---:|
|
||||||
@@ -39,8 +39,10 @@ From `v2.0.0`, this Hugo action migrated to a JavaScript (TypeScript) action. W
|
|||||||
- [⭐️ Use the latest version of Hugo](#%EF%B8%8F-use-the-latest-version-of-hugo)
|
- [⭐️ Use the latest version of Hugo](#%EF%B8%8F-use-the-latest-version-of-hugo)
|
||||||
- [Tips](#tips)
|
- [Tips](#tips)
|
||||||
- [⭐️ Read Hugo version from file](#%EF%B8%8F-read-hugo-version-from-file)
|
- [⭐️ Read Hugo version from file](#%EF%B8%8F-read-hugo-version-from-file)
|
||||||
|
- [CHANGELOG](#changelog)
|
||||||
- [License](#license)
|
- [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 -->
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
@@ -65,31 +67,31 @@ name: github pages
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-deploy:
|
build-deploy:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v1
|
||||||
# with:
|
# with:
|
||||||
# submodules: true
|
# submodules: true
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.2.4
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.59.1'
|
hugo-version: '0.62.2'
|
||||||
# extended: true
|
# extended: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo --minify
|
run: hugo --minify
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v2.5.0
|
uses: peaceiris/actions-gh-pages@v2
|
||||||
env:
|
env:
|
||||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
PUBLISH_BRANCH: gh-pages
|
PUBLISH_BRANCH: gh-pages
|
||||||
PUBLISH_DIR: ./public
|
PUBLISH_DIR: ./public
|
||||||
```
|
```
|
||||||
|
|
||||||
<div align="right">
|
<div align="right">
|
||||||
@@ -106,9 +108,9 @@ Set `extended: true` to use a Hugo extended version.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.2.4
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.59.1'
|
hugo-version: '0.62.2'
|
||||||
extended: true
|
extended: true
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -118,7 +120,7 @@ Set `hugo-version: 'latest'` to use the latest version of Hugo.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.2.4
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: 'latest'
|
hugo-version: 'latest'
|
||||||
```
|
```
|
||||||
@@ -135,12 +137,12 @@ This action fetches the latest version of Hugo by [hugo | Homebrew Formulae](htt
|
|||||||
|
|
||||||
### ⭐️ Read Hugo version from file
|
### ⭐️ Read Hugo version from file
|
||||||
|
|
||||||
How to sync a Hugo version between Docker Compose YAML file and a GitHub Actions workflow using `.env` file.
|
How to sync a Hugo version between a Docker Compose and a GitHub Actions workflow via `.env` file.
|
||||||
|
|
||||||
Write a `HUGO_VERSION` to the `.env` file like the following and push it to a remote branch.
|
Write a `HUGO_VERSION` to the `.env` file like the following and push it to a remote branch.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
HUGO_VERSION=0.59.1
|
HUGO_VERSION=0.62.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Next, add a step to read a Hugo version from the `.env` file.
|
Next, add a step to read a Hugo version from the `.env` file.
|
||||||
@@ -153,7 +155,7 @@ Next, add a step to read a Hugo version from the `.env` file.
|
|||||||
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
|
echo "::set-output name=HUGO_VERSION::${HUGO_VERSION}"
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.2.4
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
|
hugo-version: '${{ steps.hugo-version.outputs.HUGO_VERSION }}'
|
||||||
extended: true
|
extended: true
|
||||||
@@ -179,6 +181,20 @@ services:
|
|||||||
- --buildDrafts
|
- --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
|
## 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
11
__tests__/Dockerfile
Normal 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" ]
|
||||||
@@ -8,9 +8,6 @@ describe('getOS', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('test exception', () => {
|
test('test exception', () => {
|
||||||
// expect(() => {
|
|
||||||
// getOS("win32");
|
|
||||||
// }).toThrowError("Windows is not supported");
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
getOS('centos');
|
getOS('centos');
|
||||||
}).toThrowError('centos is not supported');
|
}).toThrowError('centos is not supported');
|
||||||
|
|||||||
@@ -9,14 +9,11 @@ describe('getURL()', () => {
|
|||||||
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
||||||
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
||||||
expect(getURL('Linux', 'false', '0.58.2')).toBe(urlLinux);
|
expect(getURL('Linux', 'false', '0.58.2')).toBe(urlLinux);
|
||||||
|
expect(getURL('Linux', 'true', '0.58.2')).not.toBe(urlLinux);
|
||||||
|
expect(getURL('MyOS', 'false', '0.58.2')).not.toBe(urlLinux);
|
||||||
|
expect(getURL('Linux', 'false', '0.58.1')).not.toBe(urlLinux);
|
||||||
expect(getURL('Linux', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
expect(getURL('Linux', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
||||||
expect(getURL('macOS', 'false', '0.58.2')).toBe(urlMacOS);
|
expect(getURL('macOS', 'false', '0.58.2')).toBe(urlMacOS);
|
||||||
expect(getURL('Windows', 'false', '0.58.2')).toBe(urlWindows);
|
expect(getURL('Windows', 'false', '0.58.2')).toBe(urlWindows);
|
||||||
});
|
});
|
||||||
|
|
||||||
// test("test exception", () => {
|
|
||||||
// expect(() => {
|
|
||||||
// getURL("Linux", "hoge", "0.58.2");
|
|
||||||
// }).toThrowError("Invalid input (extended): hoge");
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|||||||
1250
lib/index.js
1250
lib/index.js
File diff suppressed because it is too large
Load Diff
2070
package-lock.json
generated
2070
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
35
package.json
35
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hugo-action",
|
"name": "hugo-action",
|
||||||
"version": "2.2.0",
|
"version": "2.4.0",
|
||||||
"description": "Hugo setup action",
|
"description": "Hugo setup action",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -10,13 +10,15 @@
|
|||||||
"build": "ncc build ./src/index.ts -o lib",
|
"build": "ncc build ./src/index.ts -o lib",
|
||||||
"tsc": "tsc",
|
"tsc": "tsc",
|
||||||
"format": "prettier --write **/*.ts",
|
"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": {
|
"husky": {
|
||||||
"skipCI": true,
|
"skipCI": true,
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged",
|
"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": {
|
"lint-staged": {
|
||||||
@@ -46,24 +48,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.0",
|
"@actions/core": "^1.2.1",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.3",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.1.2",
|
"@actions/tool-cache": "^1.3.0",
|
||||||
"xmlhttprequest": "^1.8.0"
|
"xmlhttprequest": "^1.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^24.0.23",
|
"@types/jest": "^24.9.0",
|
||||||
"@types/node": "^12.12.11",
|
"@types/node": "^13.1.7",
|
||||||
"@typescript-eslint/parser": "^2.8.0",
|
"@typescript-eslint/parser": "^2.16.0",
|
||||||
"@zeit/ncc": "^0.20.5",
|
"@zeit/ncc": "^0.21.0",
|
||||||
"eslint": "^6.6.0",
|
"eslint": "^6.8.0",
|
||||||
"husky": "^3.1.0",
|
"husky": "^4.0.10",
|
||||||
"jest": "^24.9.0",
|
"jest": "^24.9.0",
|
||||||
"jest-circus": "^24.9.0",
|
"jest-circus": "^24.9.0",
|
||||||
"lint-staged": "^9.4.3",
|
"lint-staged": "^9.5.0",
|
||||||
"prettier": "1.19.1",
|
"prettier": "1.19.1",
|
||||||
"ts-jest": "^24.1.0",
|
"standard-version": "^7.0.1",
|
||||||
"typescript": "^3.7.2"
|
"ts-jest": "^24.3.0",
|
||||||
|
"typescript": "^3.7.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
48
release.sh
Executable file
48
release.sh
Executable 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}"
|
||||||
@@ -5,7 +5,6 @@ export default function getOS(platform: string) {
|
|||||||
return 'macOS';
|
return 'macOS';
|
||||||
} else if (platform === 'win32') {
|
} else if (platform === 'win32') {
|
||||||
return 'Windows';
|
return 'Windows';
|
||||||
// throw new Error("Windows is not supported");
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`${platform} is not supported`);
|
throw new Error(`${platform} is not supported`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ import installer from './installer';
|
|||||||
|
|
||||||
// most @actions toolkit packages have async methods
|
// most @actions toolkit packages have async methods
|
||||||
async function run() {
|
async function run() {
|
||||||
const dump = async () => {
|
const showVersion = async () => {
|
||||||
// Show version
|
|
||||||
await exec.exec('hugo version');
|
await exec.exec('hugo version');
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ async function run() {
|
|||||||
async function(latestVersion): Promise<void> {
|
async function(latestVersion): Promise<void> {
|
||||||
console.log(`Hugo version: ${latestVersion} (${hugoVersion})`);
|
console.log(`Hugo version: ${latestVersion} (${hugoVersion})`);
|
||||||
await installer(latestVersion);
|
await installer(latestVersion);
|
||||||
await dump();
|
await showVersion();
|
||||||
},
|
},
|
||||||
function(error) {
|
function(error) {
|
||||||
core.setFailed(error);
|
core.setFailed(error);
|
||||||
@@ -27,7 +26,7 @@ async function run() {
|
|||||||
} else {
|
} else {
|
||||||
console.log(`Hugo version: ${hugoVersion}`);
|
console.log(`Hugo version: ${hugoVersion}`);
|
||||||
await installer(hugoVersion);
|
await installer(hugoVersion);
|
||||||
await dump();
|
await showVersion();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user