Compare commits

..

30 Commits

Author SHA1 Message Date
Shohei Ueda
28797ce1ee test: fix 2020-07-17 15:56:07 +09:00
Shohei Ueda
cef7a7b43d feat: throw error for invalid extended input 2020-07-17 15:49:02 +09:00
Shohei Ueda
da2d5466d3 chore: change default branch from master to main (#386) 2020-07-17 15:38:09 +09:00
dependabot[bot]
71f80aff9f deps: bump lodash from 4.17.15 to 4.17.19 (#385)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 11:39:04 +09:00
dependabot[bot]
3f02ff7a9e deps: bump @actions/tool-cache from 1.5.5 to 1.6.0 (#383)
Bumps [@actions/tool-cache](https://github.com/actions/toolkit/tree/HEAD/packages/tool-cache) from 1.5.5 to 1.6.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/master/packages/tool-cache/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/tool-cache)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 11:21:01 +09:00
dependabot[bot]
87ff7f6586 deps: bump typescript from 3.9.6 to 3.9.7 (#384)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.6 to 3.9.7.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/compare/v3.9.6...v3.9.7)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-17 11:20:11 +09:00
peaceiris
18a17a77a8 docs: bump hugo from 0.71.1 to 0.74.1 2020-07-14 12:19:06 +09:00
dependabot[bot]
483f8d1e34 deps: bump standard-version from 8.0.1 to 8.0.2 (#382)
Bumps [standard-version](https://github.com/conventional-changelog/standard-version) from 8.0.1 to 8.0.2.
- [Release notes](https://github.com/conventional-changelog/standard-version/releases)
- [Changelog](https://github.com/conventional-changelog/standard-version/blob/master/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/standard-version/compare/v8.0.1...v8.0.2)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-14 11:18:19 +09:00
dependabot[bot]
c83f10804e deps: bump standard-version from 8.0.0 to 8.0.1 (#380)
Bumps [standard-version](https://github.com/conventional-changelog/standard-version) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/conventional-changelog/standard-version/releases)
- [Changelog](https://github.com/conventional-changelog/standard-version/blob/master/CHANGELOG.md)
- [Commits](https://github.com/conventional-changelog/standard-version/compare/v8.0.0...v8.0.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-13 15:05:14 +09:00
dependabot[bot]
cf40bc8ca5 deps: bump @types/node from 12.12.48 to 12.12.50 (#381)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.48 to 12.12.50.
- [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-13 15:05:07 +09:00
Shohei Ueda
2fa902b35f ci: add codeql workflow 2020-07-07 16:46:50 +09:00
dependabot[bot]
16d8ce1cd5 deps: bump @types/jest from 26.0.3 to 26.0.4 (#378)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.3 to 26.0.4.
- [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-07 14:26:38 +09:00
dependabot[bot]
1835230a2b deps: bump @types/node from 12.12.47 to 12.12.48 (#379)
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.47 to 12.12.48.
- [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-07 14:26:28 +09:00
dependabot[bot]
f1c7ecda61 deps: bump eslint-plugin-jest from 23.17.1 to 23.18.0 (#377)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.17.1 to 23.18.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.17.1...v23.18.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-06 15:44:04 +09:00
Shohei Ueda
96f56dee02 deps: bump node from 12.18.1 to 12.18.2 (#376) 2020-07-02 22:38:14 +09:00
dependabot[bot]
863939f1a7 deps: bump typescript from 3.9.5 to 3.9.6 (#374)
Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.9.5 to 3.9.6.
- [Release notes](https://github.com/Microsoft/TypeScript/releases)
- [Commits](https://github.com/Microsoft/TypeScript/commits)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-02 13:13:39 +09:00
dependabot[bot]
00ad5734ff ci: bump codecov/codecov-action from v1.0.7 to v1.0.10 (#373)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.0.7 to v1.0.10.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Commits](https://github.com/codecov/codecov-action/compare/v1.0.7...f3570723ef743f6942b6a480461ed0cd6c0f9baa)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-02 13:13:01 +09:00
dependabot[bot]
eb88818df9 deps: bump nock from 13.0.1 to 13.0.2 (#375)
Bumps [nock](https://github.com/nock/nock) from 13.0.1 to 13.0.2.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.0.1...v13.0.2)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-02 13:11:23 +09:00
dependabot[bot]
45f920d29b deps: bump nock from 13.0.0 to 13.0.1 (#372)
Bumps [nock](https://github.com/nock/nock) from 13.0.0 to 13.0.1.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v13.0.0...v13.0.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-01 14:00:30 +09:00
dependabot[bot]
d59d21e633 ci: bump actions/setup-node from v2.0.0 to v2.1.0 (#371)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from v2.0.0 to v2.1.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2.0.0...1ae8f4b1fd89676f69b55d3dd6932b6df089ff7b)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-30 18:51:36 +09:00
dependabot[bot]
e4507caf0b deps: bump nock from 12.0.3 to 13.0.0 (#370)
Bumps [nock](https://github.com/nock/nock) from 12.0.3 to 13.0.0.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/nock/nock/compare/v12.0.3...v13.0.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-29 11:53:20 +09:00
dependabot[bot]
f42b9853d3 deps: bump @types/jest from 26.0.0 to 26.0.3 (#369)
Bumps [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest) from 26.0.0 to 26.0.3.
- [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-06-25 17:11:42 +09:00
dependabot[bot]
638096b27f deps: bump eslint-plugin-jest from 23.16.0 to 23.17.1 (#368)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.16.0 to 23.17.1.
- [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.16.0...v23.17.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-24 15:13:10 +09:00
Shohei Ueda
53a8986af5 ci: remove open-pull-requests-limit 2020-06-24 14:10:03 +09:00
dependabot[bot]
838268abaf deps: bump jest-circus from 26.0.1 to 26.1.0 (#367)
Bumps [jest-circus](https://github.com/facebook/jest/tree/HEAD/packages/jest-circus) from 26.0.1 to 26.1.0.
- [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.1.0/packages/jest-circus)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-24 14:08:58 +09:00
dependabot[bot]
9f4ef016d6 deps: bump eslint-plugin-jest from 23.13.2 to 23.16.0 (#366)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 23.13.2 to 23.16.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.13.2...v23.16.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-22 14:29:08 +09:00
Shohei Ueda
8bff475612 chore: change printWidth from 80 to 100 (#365) 2020-06-22 05:40:06 +09:00
dependabot[bot]
be3787356a ci: bump peaceiris/actions-label-commenter from v1 to v1.3.7 (#364)
Bumps [peaceiris/actions-label-commenter](https://github.com/peaceiris/actions-label-commenter) from v1 to v1.3.7.
- [Release notes](https://github.com/peaceiris/actions-label-commenter/releases)
- [Changelog](https://github.com/peaceiris/actions-label-commenter/blob/master/CHANGELOG.md)
- [Commits](https://github.com/peaceiris/actions-label-commenter/compare/v1...56d53284bcd1157938a58751728e275ebf9d3ec7)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-22 03:34:59 +09:00
Shohei Ueda
919a5f9b0b chore: fix link to GitHub Actions Community Forum 2020-06-22 03:32:45 +09:00
peaceiris
20fdc5a174 chore(release): Remove build assets [skip ci] 2020-06-21 13:19:00 +09:00
20 changed files with 829 additions and 7681 deletions

View File

@@ -6,7 +6,6 @@ updates:
interval: daily
time: '11:00'
timezone: Japan
open-pull-requests-limit: 1
labels:
- "dependencies"
ignore:

View File

@@ -9,7 +9,7 @@ labels:
issue:
body: |
Please ask questions about GitHub Actions or Hugo at the following forum.
- [GitHub Actions Community Forum](https://github.community/t5/GitHub-Actions/bd-p/actions)
- [GitHub Actions Community Forum](https://github.community/c/github-actions)
- [Hugo Community Forum](https://discourse.gohugo.io/)
action: close
- name: wontfix

29
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,29 @@
name: "Code Scanning"
on:
push:
branches:
- main
pull_request:
jobs:
CodeQL-Build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@@ -3,7 +3,7 @@ name: 'Dev Image CI'
on:
push:
branches:
- master
- main
paths:
- '.github/workflows/dev-image.yml'
- '.dockerignore'

View File

@@ -16,10 +16,10 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: master
ref: main
- name: Label Commenter
uses: peaceiris/actions-label-commenter@v1
uses: peaceiris/actions-label-commenter@v1.3.7
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# config_file: .github/label-commenter-config.yml

View File

@@ -3,7 +3,7 @@ name: 'Test'
on:
push:
branches:
- master
- main
paths-ignore:
- '**.md'
pull_request:
@@ -29,7 +29,7 @@ jobs:
id: nvm
- name: Setup Node
uses: actions/setup-node@v2.0.0
uses: actions/setup-node@v2.1.0
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'
@@ -56,6 +56,6 @@ jobs:
name: coverage-${{ matrix.os }}
path: coverage
- uses: codecov/codecov-action@v1.0.7
- uses: codecov/codecov-action@v1.0.10
with:
token: ${{ secrets.CODECOV_TOKEN }}

2
.nvmrc
View File

@@ -1 +1 @@
12.18.1
12.18.2

View File

@@ -1,11 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}

View File

@@ -1,11 +1,11 @@
[![license](https://img.shields.io/github/license/peaceiris/actions-hugo.svg)](https://github.com/peaceiris/actions-hugo/blob/master/LICENSE)
[![license](https://img.shields.io/github/license/peaceiris/actions-hugo.svg)](https://github.com/peaceiris/actions-hugo/blob/main/LICENSE)
[![release](https://img.shields.io/github/release/peaceiris/actions-hugo.svg)](https://github.com/peaceiris/actions-hugo/releases/latest)
[![GitHub release date](https://img.shields.io/github/release-date/peaceiris/actions-hugo.svg)](https://github.com/peaceiris/actions-hugo/releases)
[![Release Feed](https://img.shields.io/badge/release-feed-yellow)](https://github.com/peaceiris/actions-hugo/releases.atom)
![Test](https://github.com/peaceiris/actions-hugo/workflows/Test/badge.svg?branch=master&event=push)
![Test](https://github.com/peaceiris/actions-hugo/workflows/Test/badge.svg?branch=main&event=push)
[![CodeFactor](https://www.codefactor.io/repository/github/peaceiris/actions-hugo/badge)](https://www.codefactor.io/repository/github/peaceiris/actions-hugo)
[![codecov](https://codecov.io/gh/peaceiris/actions-hugo/branch/master/graph/badge.svg)](https://codecov.io/gh/peaceiris/actions-hugo)
[![codecov](https://codecov.io/gh/peaceiris/actions-hugo/branch/main/graph/badge.svg)](https://codecov.io/gh/peaceiris/actions-hugo)
[![Maintainability](https://api.codeclimate.com/v1/badges/ebf2eef3a046b396ba9c/maintainability)](https://codeclimate.com/github/peaceiris/actions-hugo/maintainability)
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
@@ -75,7 +75,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -89,7 +89,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.71.1'
hugo-version: '0.74.1'
# extended: true
- name: Build
@@ -118,7 +118,7 @@ Set `extended: true` to use a Hugo extended version.
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.71.1'
hugo-version: '0.74.1'
extended: true
```
@@ -150,7 +150,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.71.1
HUGO_VERSION=0.74.1
```
Next, add a step to read a Hugo version from the `.env` file.
@@ -210,7 +210,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -224,7 +224,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.71.1'
hugo-version: '0.74.1'
extended: true
- name: Setup Node
@@ -259,7 +259,7 @@ name: github pages
on:
push:
branches:
- master
- main
jobs:
deploy:
@@ -273,7 +273,7 @@ jobs:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.71.1'
hugo-version: '0.74.1'
extended: true
- name: Setup Ruby
@@ -310,7 +310,7 @@ jobs:
- [MIT License - peaceiris/actions-hugo]
[MIT License - peaceiris/actions-hugo]: https://github.com/peaceiris/actions-hugo/blob/master/LICENSE
[MIT License - peaceiris/actions-hugo]: https://github.com/peaceiris/actions-hugo/blob/main/LICENSE

View File

@@ -27,15 +27,9 @@ describe('getURL()', () => {
describe('getLatestVersion()', () => {
test('return latest version via brew', async () => {
nock('https://formulae.brew.sh')
.get(`/api/formula/${Tool.Repo}.json`)
.reply(200, jsonTestBrew);
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
const versionLatest: string = await getLatestVersion(
Tool.Org,
Tool.Repo,
'brew'
);
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
expect(versionLatest).toMatch(Tool.TestVersionLatest);
});
@@ -44,21 +38,13 @@ describe('getLatestVersion()', () => {
.get(`/repos/${Tool.Org}/${Tool.Repo}/releases/latest`)
.reply(200, jsonTestGithub);
const versionLatest: string = await getLatestVersion(
Tool.Org,
Tool.Repo,
'github'
);
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'github');
expect(versionLatest).toMatch(Tool.TestVersionLatest);
});
test('return exception 404', async () => {
nock('https://formulae.brew.sh')
.get(`/api/formula/${Tool.Repo}.json`)
.reply(404);
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
await expect(
getLatestVersion(Tool.Org, Tool.Repo, 'brew')
).rejects.toThrowError(FetchError);
await expect(getLatestVersion(Tool.Org, Tool.Repo, 'brew')).rejects.toThrowError(FetchError);
});
});

View File

@@ -2,8 +2,7 @@ import getURL from '../src/get-url';
describe('getURL()', () => {
test('test', () => {
const baseURL =
'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;

View File

@@ -25,6 +25,7 @@ describe('Integration testing run()', () => {
test('succeed in installing a custom version', async () => {
const testVersion = Tool.TestVersionSpec;
process.env['INPUT_HUGO-VERSION'] = testVersion;
process.env['INPUT_EXTENDED'] = 'false';
const result: main.ActionResult = await main.run();
expect(result.exitcode).toBe(0);
expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`);
@@ -43,37 +44,28 @@ describe('Integration testing run()', () => {
test('succeed in installing the latest version', async () => {
const testVersion = 'latest';
process.env['INPUT_HUGO-VERSION'] = testVersion;
nock('https://formulae.brew.sh')
.get(`/api/formula/${Tool.Repo}.json`)
.reply(200, jsonTestBrew);
process.env['INPUT_EXTENDED'] = 'false';
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
const result: main.ActionResult = await main.run();
expect(result.exitcode).toBe(0);
expect(result.output).toMatch(
`Hugo Static Site Generator v${Tool.TestVersionLatest}`
);
expect(result.output).toMatch(`Hugo Static Site Generator v${Tool.TestVersionLatest}`);
});
test('succeed in installing the latest extended version', async () => {
const testVersion = 'latest';
process.env['INPUT_HUGO-VERSION'] = testVersion;
process.env['INPUT_EXTENDED'] = 'true';
nock('https://formulae.brew.sh')
.get(`/api/formula/${Tool.Repo}.json`)
.reply(200, jsonTestBrew);
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
const result: main.ActionResult = await main.run();
expect(result.exitcode).toBe(0);
expect(result.output).toMatch(
`Hugo Static Site Generator v${Tool.TestVersionLatest}`
);
expect(result.output).toMatch(`Hugo Static Site Generator v${Tool.TestVersionLatest}`);
expect(result.output).toMatch(`extended`);
});
test('fail to install the latest version due to 404 of brew', async () => {
process.env['INPUT_HUGO-VERSION'] = 'latest';
nock('https://formulae.brew.sh')
.get(`/api/formula/${Tool.Repo}.json`)
.reply(404);
process.env['INPUT_EXTENDED'] = 'false';
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
await expect(main.run()).rejects.toThrowError(FetchError);
});
});
@@ -91,8 +83,6 @@ describe('showVersion()', () => {
});
test('return not found', async () => {
await expect(
main.showVersion('gitgit', ['--version'])
).rejects.toThrowError(Error);
await expect(main.showVersion('gitgit', ['--version'])).rejects.toThrowError(Error);
});
});

File diff suppressed because it is too large Load Diff

1288
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@
}
},
"lint-staged": {
"src/**/*.ts": [
"{src,__tests__}/**/*.ts": [
"prettier --check",
"eslint"
],
@@ -57,26 +57,26 @@
"@actions/core": "^1.2.4",
"@actions/exec": "^1.0.4",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.5.5",
"@actions/tool-cache": "^1.6.0",
"node-fetch": "^2.6.0"
},
"devDependencies": {
"@types/jest": "^26.0.0",
"@types/jest": "^26.0.4",
"@types/node": "~12",
"@types/node-fetch": "^2.5.7",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"@zeit/ncc": "^0.22.3",
"eslint": "^6.8.0",
"eslint-plugin-jest": "^23.13.2",
"eslint-plugin-jest": "^23.18.0",
"husky": "^4.2.5",
"jest": "^25.5.4",
"jest-circus": "^26.0.1",
"jest-circus": "^26.1.0",
"lint-staged": "^10.2.11",
"nock": "^12.0.3",
"nock": "^13.0.2",
"prettier": "2.0.5",
"standard-version": "^8.0.0",
"standard-version": "^8.0.2",
"ts-jest": "^25.5.1",
"typescript": "^3.9.5"
"typescript": "^3.9.7"
}
}

View File

@@ -3,8 +3,10 @@
# 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
DEFAULT_BRANCH="main"
if [ "$(git branch --show-current)" != "${DEFAULT_BRANCH}" ]; then
echo "$0: Current branch is not ${DEFAULT_BRANCH}" 1>&2
exit 1
fi
@@ -26,7 +28,7 @@ if [ "${res}" = "n" ]; then
fi
git fetch origin
git pull origin master
git pull origin "${DEFAULT_BRANCH}"
git tag -d v2 || true
git pull origin --tags
@@ -44,5 +46,5 @@ 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 "${DEFAULT_BRANCH}"
git push origin "${TAG_NAME}"

View File

@@ -12,11 +12,7 @@ export function getURL(org: string, repo: string, api: string): string {
return url;
}
export async function getLatestVersion(
org: string,
repo: string,
api: string
): Promise<string> {
export async function getLatestVersion(org: string, repo: string, api: string): Promise<string> {
const url = getURL(org, repo, api);
const response = await fetch(url);
const json = await response.json();

View File

@@ -1,15 +1,11 @@
export default function getURL(
os: string,
extended: string,
version: string
): string {
export default function getURL(os: string, extended: string, version: string): string {
const extendedStr = (extended: string): string => {
if (extended === 'true') {
return 'extended_';
} else {
} else if (extended === 'false') {
return '';
// } else {
// throw new Error(`Invalid input (extended): ${extended}`);
} else {
throw new Error(`Invalid input (extended): ${extended}`);
}
};

View File

@@ -59,16 +59,10 @@ export async function installer(version: string): Promise<void> {
const toolAssets: string = await tc.downloadTool(toolURL);
let toolBin = '';
if (process.platform === 'win32') {
const toolExtractedFolder: string = await tc.extractZip(
toolAssets,
tempDir
);
const toolExtractedFolder: string = await tc.extractZip(toolAssets, tempDir);
toolBin = `${toolExtractedFolder}/${Tool.CmdName}.exe`;
} else {
const toolExtractedFolder: string = await tc.extractTar(
toolAssets,
tempDir
);
const toolExtractedFolder: string = await tc.extractTar(toolAssets, tempDir);
toolBin = `${toolExtractedFolder}/${Tool.CmdName}`;
}
await io.mv(toolBin, binDir);

View File

@@ -9,10 +9,7 @@ export interface ActionResult {
output: string;
}
export async function showVersion(
cmd: string,
args: string[]
): Promise<ActionResult> {
export async function showVersion(cmd: string, args: string[]): Promise<ActionResult> {
const result: ActionResult = {
exitcode: 0,
output: ''