mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 20:32:19 +01:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cb9216401 | ||
|
|
20ff13abbd | ||
|
|
6812c21f18 | ||
|
|
a1b1127907 | ||
|
|
02c90246b4 | ||
|
|
5000d1a8b6 | ||
|
|
63038f397f | ||
|
|
7e8dab4a15 | ||
|
|
8f4af8fa35 | ||
|
|
b8b4d74381 | ||
|
|
94853340b9 | ||
|
|
de65f3e128 | ||
|
|
c00fd7be83 | ||
|
|
7c0de2ddec | ||
|
|
236f382aa6 | ||
|
|
1bb54b05c8 | ||
|
|
b28afd97fa | ||
|
|
46a6a3afdf | ||
|
|
6e5afb7c2e | ||
|
|
737fda5741 | ||
|
|
c58f4ce12d | ||
|
|
95afbe8abf | ||
|
|
8f7332cde6 | ||
|
|
699805b6e1 | ||
|
|
2550d0ecb0 | ||
|
|
692ded2284 | ||
|
|
e9732216ce | ||
|
|
3315ca857b | ||
|
|
8d85402748 | ||
|
|
b4a0e8ba60 | ||
|
|
66d664bedd | ||
|
|
87e38e224d | ||
|
|
4fb2901627 | ||
|
|
7a50ddc694 | ||
|
|
b55f1c81fb | ||
|
|
0311892edd | ||
|
|
94ce32ea1b | ||
|
|
3317963a65 | ||
|
|
a79f520add | ||
|
|
b6a7551978 | ||
|
|
490ff3b995 |
@@ -2,7 +2,7 @@ version: 1
|
||||
update_configs:
|
||||
- package_manager: "javascript"
|
||||
directory: "/"
|
||||
update_schedule: "weekly"
|
||||
update_schedule: "daily"
|
||||
default_labels:
|
||||
- "dependencies"
|
||||
commit_message:
|
||||
|
||||
@@ -1,7 +1,2 @@
|
||||
.*
|
||||
|
||||
!.eslintrc.json
|
||||
!.prettierrc.json
|
||||
|
||||
coverage
|
||||
node_modules
|
||||
*
|
||||
|
||||
@@ -7,3 +7,7 @@ indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[Makefile]
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
|
||||
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@@ -17,17 +17,10 @@ jobs:
|
||||
GITHUB_CONTEXT: ${{ toJson(github) }}
|
||||
run: echo "${GITHUB_CONTEXT}"
|
||||
|
||||
- name: Install hub
|
||||
- name: Install github/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}"
|
||||
export HUB_VERSION="2.14.1"
|
||||
curl -fsSL https://github.com/github/hub/raw/40e421edd2c63d57bb8daa4bb9bbdfa21e8becf9/script/get | bash -s "${HUB_VERSION}"
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
@@ -35,8 +28,9 @@ jobs:
|
||||
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 \
|
||||
RELEASE_NAME="$(jq -r '.name' ./package.json)"
|
||||
sed -i "1i${RELEASE_NAME} ${TAG_NAME}\n" ./release_notes.md
|
||||
./bin/hub release create \
|
||||
--draft \
|
||||
--prerelease \
|
||||
--file ./release_notes.md \
|
||||
|
||||
7
.github/workflows/test-action.yml
vendored
7
.github/workflows/test-action.yml
vendored
@@ -30,4 +30,9 @@ jobs:
|
||||
hugo-version: ${{ matrix.hugo-version }}
|
||||
extended: ${{ matrix.extended }}
|
||||
|
||||
- run: hugo version
|
||||
- name: Run hugo version
|
||||
run: echo "::set-output name=hugo_version::$(hugo version)"
|
||||
id: hugo_version
|
||||
|
||||
- name: '${{ steps.hugo_version.outputs.hugo_version }}'
|
||||
run: echo '${{ steps.hugo_version.outputs.hugo_version }}'
|
||||
|
||||
22
.github/workflows/test.yml
vendored
22
.github/workflows/test.yml
vendored
@@ -76,14 +76,18 @@ jobs:
|
||||
name: coverage
|
||||
path: coverage
|
||||
|
||||
- name: Upload test coverage to Coveralls
|
||||
uses: coverallsapp/github-action@v1.0.1
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
parallel: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Coveralls Finished
|
||||
uses: coverallsapp/github-action@v1.0.1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
parallel-finished: true
|
||||
# - 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
|
||||
|
||||
83
CHANGELOG.md
83
CHANGELOG.md
@@ -2,6 +2,89 @@
|
||||
|
||||
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.4](https://github.com/peaceiris/actions-hugo/compare/v2.4.3...v2.4.4) (2020-01-28)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* ignore failure ([7c0de2d](https://github.com/peaceiris/actions-hugo/commit/7c0de2ddec0ad6a617eed9a78836b75151c9f870))
|
||||
* update git (#150) ([c00fd7b](https://github.com/peaceiris/actions-hugo/commit/c00fd7be83dad02c1e07a09bfb526a3e2d67fa75)), closes [#150](https://github.com/peaceiris/actions-hugo/issues/150)
|
||||
* update name ([8f4af8f](https://github.com/peaceiris/actions-hugo/commit/8f4af8fa35a55337783683108d969c57a9541dae))
|
||||
|
||||
### ci
|
||||
|
||||
* remove operations-per-run ([de65f3e](https://github.com/peaceiris/actions-hugo/commit/de65f3e1283667e67fe0676a6498d02951ee22d5))
|
||||
* use github/hub install script [skip ci] ([7e8dab4](https://github.com/peaceiris/actions-hugo/commit/7e8dab4a1585bb1241a44c53eeae4acc25fe0661))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/jest from 24.9.1 to 25.1.0 ([02c9024](https://github.com/peaceiris/actions-hugo/commit/02c90246b441e21119ffe228b29c43ac443ca688))
|
||||
* bump @typescript-eslint/eslint-plugin from 2.17.0 to 2.18.0 ([a1b1127](https://github.com/peaceiris/actions-hugo/commit/a1b1127907729bf5a7533f63111feaf16919ee1b))
|
||||
* bump @typescript-eslint/parser from 2.17.0 to 2.18.0 ([6812c21](https://github.com/peaceiris/actions-hugo/commit/6812c21f1895dbef58aca3a976d0d3852d660dd0))
|
||||
* bump lint-staged from 10.0.2 to 10.0.3 ([5000d1a](https://github.com/peaceiris/actions-hugo/commit/5000d1a8b64a136a7350b3f3debc93fb21872a06))
|
||||
|
||||
### docs
|
||||
|
||||
* Add release feed badge ([b8b4d74](https://github.com/peaceiris/actions-hugo/commit/b8b4d743819166af3ff7f530bbdc6d3480913cb9))
|
||||
* update badge ([63038f3](https://github.com/peaceiris/actions-hugo/commit/63038f397f199600101c79aca6bc505c8718d1b7))
|
||||
|
||||
### fix
|
||||
|
||||
* action failure status (#151) ([9485334](https://github.com/peaceiris/actions-hugo/commit/94853340b9510c41a18016dbaa8d41e42044300c)), closes [#151](https://github.com/peaceiris/actions-hugo/issues/151) [#149](https://github.com/peaceiris/actions-hugo/issues/149)
|
||||
|
||||
|
||||
|
||||
## [2.4.3](https://github.com/peaceiris/actions-hugo/compare/v2.4.2...v2.4.3) (2020-01-24)
|
||||
|
||||
|
||||
### chore
|
||||
|
||||
* Change update_schedule from weekly to daily ([737fda5](https://github.com/peaceiris/actions-hugo/commit/737fda5741cb12d8992d4c75e249bd0392e162a7))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @actions/core from 1.2.1 to 1.2.2 ([6e5afb7](https://github.com/peaceiris/actions-hugo/commit/6e5afb7c2e3739813acca54db234f1c13cf1e596))
|
||||
* bump @actions/tool-cache from 1.3.0 to 1.3.1 ([46a6a3a](https://github.com/peaceiris/actions-hugo/commit/46a6a3afdff838a10f9f9e063170cfc02c197611))
|
||||
|
||||
|
||||
|
||||
## [2.4.2](https://github.com/peaceiris/actions-hugo/compare/v2.4.1...v2.4.2) (2020-01-23)
|
||||
|
||||
|
||||
### ci
|
||||
|
||||
* Add codecov/codecov-action@v1 (#136) ([94ce32e](https://github.com/peaceiris/actions-hugo/commit/94ce32ea1b2965037ef7bbec618476ed6ad7b9e6)), closes [#136](https://github.com/peaceiris/actions-hugo/issues/136)
|
||||
* Add Hugo version dump step ([7a50ddc](https://github.com/peaceiris/actions-hugo/commit/7a50ddc6941e49c88a35080315a84a684c825347))
|
||||
* Add operations-per-run 1 ([b6a7551](https://github.com/peaceiris/actions-hugo/commit/b6a75519788da01712462416009e656ec0b9cc8d))
|
||||
|
||||
### deps
|
||||
|
||||
* bump @types/jest from 24.9.0 to 24.9.1 ([2550d0e](https://github.com/peaceiris/actions-hugo/commit/2550d0ecb023988fa8061c6270a46e9d67bb84dc))
|
||||
* bump @types/node from 13.1.8 to 13.5.0 ([8d85402](https://github.com/peaceiris/actions-hugo/commit/8d854027489e6b4b9130701c3a826185aca6bfae))
|
||||
* bump @typescript-eslint/eslint-plugin from 2.16.0 to 2.17.0 ([66d664b](https://github.com/peaceiris/actions-hugo/commit/66d664bedd9b4a5d5004dc4023557305c4d69d97))
|
||||
* bump @typescript-eslint/parser from 2.16.0 to 2.17.0 (#144) ([692ded2](https://github.com/peaceiris/actions-hugo/commit/692ded22845285c58250414c6389365f01229c49)), closes [#144](https://github.com/peaceiris/actions-hugo/issues/144)
|
||||
* bump husky from 4.0.10 to 4.2.1 ([e973221](https://github.com/peaceiris/actions-hugo/commit/e9732216ceb5db53dac31f61b0bb7d03db346f3a))
|
||||
* bump jest and ts-jest ([3315ca8](https://github.com/peaceiris/actions-hugo/commit/3315ca857b7ee10f6c9de622898e44583fd81132))
|
||||
* bump jest-circus from 24.9.0 to 25.1.0 ([b4a0e8b](https://github.com/peaceiris/actions-hugo/commit/b4a0e8ba604f9aeccee1f7b409870b3605de8544))
|
||||
* bump lint-staged from 10.0.0 to 10.0.2 ([87e38e2](https://github.com/peaceiris/actions-hugo/commit/87e38e224d4a8f50a19dc9904c0bb85f707197bd))
|
||||
* bump standard-version from 7.0.1 to 7.1.0 (#145) ([699805b](https://github.com/peaceiris/actions-hugo/commit/699805b6e156fb30665896aa7c1cbbca130a1364)), closes [#145](https://github.com/peaceiris/actions-hugo/issues/145)
|
||||
* update ([3317963](https://github.com/peaceiris/actions-hugo/commit/3317963a656646a401fcf4d1420b50f5908e3be0))
|
||||
|
||||
### docs
|
||||
|
||||
* Add Codecov badge ([0311892](https://github.com/peaceiris/actions-hugo/commit/0311892edd4e91aac6a95a003243e44ad3a54fe0))
|
||||
* Update action execution time ([a79f520](https://github.com/peaceiris/actions-hugo/commit/a79f520addd8c317fcb9b29e8ecc4a8b0ecc43ae))
|
||||
|
||||
### style
|
||||
|
||||
* remove extra whitespace [skip ci] ([4fb2901](https://github.com/peaceiris/actions-hugo/commit/4fb290162762a7f823fcab1984966da8d8aed547))
|
||||
|
||||
### test
|
||||
|
||||
* Add fail to fetch latest due to 404 (#137) ([b55f1c8](https://github.com/peaceiris/actions-hugo/commit/b55f1c81fb24bc6149b3a7ec4cb9aa6c9596e877)), closes [#137](https://github.com/peaceiris/actions-hugo/issues/137)
|
||||
|
||||
|
||||
|
||||
## [2.4.1](https://github.com/peaceiris/actions-hugo/compare/v2.4.0...v2.4.1) (2020-01-18)
|
||||
|
||||
|
||||
|
||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
||||
ARG NODE_VERSION
|
||||
|
||||
FROM node:${NODE_VERSION}-buster-slim
|
||||
|
||||
SHELL ["/bin/bash", "-l", "-c"]
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev autoconf \
|
||||
ca-certificates \
|
||||
wget && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /git
|
||||
ENV GIT_VERSION="2.25.0"
|
||||
RUN wget -q "https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz" && \
|
||||
tar -zxf "./v${GIT_VERSION}.tar.gz" && \
|
||||
rm "./v${GIT_VERSION}.tar.gz" && \
|
||||
cd "./git-${GIT_VERSION}" && \
|
||||
make configure && \
|
||||
./configure --prefix=/usr && \
|
||||
make all && \
|
||||
make install
|
||||
|
||||
WORKDIR /repo
|
||||
|
||||
CMD [ "bash" ]
|
||||
7
Makefile
7
Makefile
@@ -1,8 +1,9 @@
|
||||
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)
|
||||
IMAGE_NAME := actions_hugo_dev:latest
|
||||
NODE_VERSION := $(shell cat ./.nvmrc)
|
||||
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
||||
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
||||
|
||||
|
||||
.PHONY: build
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
[](https://github.com/peaceiris/actions-hugo/blob/master/LICENSE)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases/latest)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases)
|
||||

|
||||

|
||||
[](https://www.codefactor.io/repository/github/peaceiris/actions-hugo)
|
||||
[](https://coveralls.io/github/peaceiris/actions-hugo?branch=master)
|
||||
[](https://codecov.io/gh/peaceiris/actions-hugo)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases.atom)
|
||||
|
||||
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
|
||||
|
||||
@@ -18,7 +19,7 @@ This **Hugo Setup Action** can install **Hugo** to a virtual machine of **GitHub
|
||||
|
||||
From `v2`, this Hugo Setup Action has 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 **1 sec**.
|
||||
Thanks to this change, we can complete this action in less than a few seconds.
|
||||
(A docker base action was taking about 1 min or more execution time to build and pull a docker image.)
|
||||
|
||||
| OS (runs-on) | ubuntu-18.04 | macos-latest | windows-2019 |
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
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" ]
|
||||
@@ -3,25 +3,23 @@ import * as io from '@actions/io';
|
||||
import path from 'path';
|
||||
import nock from 'nock';
|
||||
import {Tool, Action} from '../src/constants';
|
||||
// import {FetchError} from 'node-fetch';
|
||||
import {FetchError} from 'node-fetch';
|
||||
import jsonTestBrew from './data/brew.json';
|
||||
// import jsonTestGithub from './data/github.json';
|
||||
|
||||
jest.setTimeout(30000);
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env['INPUT_HUGO-VERSION'];
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
describe('Integration testing run()', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
const workDir = path.join(`${process.env.HOME}`, Action.WorkDirName);
|
||||
await io.rmRF(workDir);
|
||||
|
||||
delete process.env['INPUT_HUGO-VERSION'];
|
||||
nock.cleanAll();
|
||||
});
|
||||
|
||||
test('succeed in installing a custom version', async () => {
|
||||
@@ -69,6 +67,15 @@ describe('Integration testing run()', () => {
|
||||
);
|
||||
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);
|
||||
|
||||
await expect(main.run()).rejects.toThrowError(FetchError);
|
||||
});
|
||||
});
|
||||
|
||||
describe('showVersion()', () => {
|
||||
|
||||
486
lib/index.js
486
lib/index.js
@@ -934,6 +934,13 @@ class ExecState extends events.EventEmitter {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 16:
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = require("tls");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 18:
|
||||
/***/ (function() {
|
||||
|
||||
@@ -1006,28 +1013,22 @@ function showVersion(cmd, args) {
|
||||
exports.showVersion = showVersion;
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const toolVersion = core.getInput('hugo-version');
|
||||
let installVersion = '';
|
||||
let result = {
|
||||
exitcode: 0,
|
||||
output: ''
|
||||
};
|
||||
if (toolVersion === '' || toolVersion === 'latest') {
|
||||
installVersion = yield get_latest_version_1.getLatestVersion(constants_1.Tool.Org, constants_1.Tool.Repo, 'brew');
|
||||
}
|
||||
else {
|
||||
installVersion = toolVersion;
|
||||
}
|
||||
core.info(`${constants_1.Tool.Name} version: ${installVersion}`);
|
||||
yield installer_1.installer(installVersion);
|
||||
result = yield showVersion(constants_1.Tool.CmdName, [constants_1.Tool.CmdOptVersion]);
|
||||
return result;
|
||||
const toolVersion = core.getInput('hugo-version');
|
||||
let installVersion = '';
|
||||
let result = {
|
||||
exitcode: 0,
|
||||
output: ''
|
||||
};
|
||||
if (toolVersion === '' || toolVersion === 'latest') {
|
||||
installVersion = yield get_latest_version_1.getLatestVersion(constants_1.Tool.Org, constants_1.Tool.Repo, 'brew');
|
||||
}
|
||||
catch (e) {
|
||||
core.setFailed(`Action failed with error ${e}`);
|
||||
return e;
|
||||
else {
|
||||
installVersion = toolVersion;
|
||||
}
|
||||
core.info(`${constants_1.Tool.Name} version: ${installVersion}`);
|
||||
yield installer_1.installer(installVersion);
|
||||
result = yield showVersion(constants_1.Tool.CmdName, [constants_1.Tool.CmdOptVersion]);
|
||||
return result;
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
@@ -1050,10 +1051,274 @@ module.exports = function nodeRNG() {
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 157:
|
||||
/***/ (function() {
|
||||
/***/ 141:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
eval("require")("tunnel");
|
||||
"use strict";
|
||||
|
||||
|
||||
var net = __webpack_require__(631);
|
||||
var tls = __webpack_require__(16);
|
||||
var http = __webpack_require__(605);
|
||||
var https = __webpack_require__(211);
|
||||
var events = __webpack_require__(614);
|
||||
var assert = __webpack_require__(357);
|
||||
var util = __webpack_require__(669);
|
||||
|
||||
|
||||
exports.httpOverHttp = httpOverHttp;
|
||||
exports.httpsOverHttp = httpsOverHttp;
|
||||
exports.httpOverHttps = httpOverHttps;
|
||||
exports.httpsOverHttps = httpsOverHttps;
|
||||
|
||||
|
||||
function httpOverHttp(options) {
|
||||
var agent = new TunnelingAgent(options);
|
||||
agent.request = http.request;
|
||||
return agent;
|
||||
}
|
||||
|
||||
function httpsOverHttp(options) {
|
||||
var agent = new TunnelingAgent(options);
|
||||
agent.request = http.request;
|
||||
agent.createSocket = createSecureSocket;
|
||||
agent.defaultPort = 443;
|
||||
return agent;
|
||||
}
|
||||
|
||||
function httpOverHttps(options) {
|
||||
var agent = new TunnelingAgent(options);
|
||||
agent.request = https.request;
|
||||
return agent;
|
||||
}
|
||||
|
||||
function httpsOverHttps(options) {
|
||||
var agent = new TunnelingAgent(options);
|
||||
agent.request = https.request;
|
||||
agent.createSocket = createSecureSocket;
|
||||
agent.defaultPort = 443;
|
||||
return agent;
|
||||
}
|
||||
|
||||
|
||||
function TunnelingAgent(options) {
|
||||
var self = this;
|
||||
self.options = options || {};
|
||||
self.proxyOptions = self.options.proxy || {};
|
||||
self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets;
|
||||
self.requests = [];
|
||||
self.sockets = [];
|
||||
|
||||
self.on('free', function onFree(socket, host, port, localAddress) {
|
||||
var options = toOptions(host, port, localAddress);
|
||||
for (var i = 0, len = self.requests.length; i < len; ++i) {
|
||||
var pending = self.requests[i];
|
||||
if (pending.host === options.host && pending.port === options.port) {
|
||||
// Detect the request to connect same origin server,
|
||||
// reuse the connection.
|
||||
self.requests.splice(i, 1);
|
||||
pending.request.onSocket(socket);
|
||||
return;
|
||||
}
|
||||
}
|
||||
socket.destroy();
|
||||
self.removeSocket(socket);
|
||||
});
|
||||
}
|
||||
util.inherits(TunnelingAgent, events.EventEmitter);
|
||||
|
||||
TunnelingAgent.prototype.addRequest = function addRequest(req, host, port, localAddress) {
|
||||
var self = this;
|
||||
var options = mergeOptions({request: req}, self.options, toOptions(host, port, localAddress));
|
||||
|
||||
if (self.sockets.length >= this.maxSockets) {
|
||||
// We are over limit so we'll add it to the queue.
|
||||
self.requests.push(options);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are under maxSockets create a new one.
|
||||
self.createSocket(options, function(socket) {
|
||||
socket.on('free', onFree);
|
||||
socket.on('close', onCloseOrRemove);
|
||||
socket.on('agentRemove', onCloseOrRemove);
|
||||
req.onSocket(socket);
|
||||
|
||||
function onFree() {
|
||||
self.emit('free', socket, options);
|
||||
}
|
||||
|
||||
function onCloseOrRemove(err) {
|
||||
self.removeSocket(socket);
|
||||
socket.removeListener('free', onFree);
|
||||
socket.removeListener('close', onCloseOrRemove);
|
||||
socket.removeListener('agentRemove', onCloseOrRemove);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
TunnelingAgent.prototype.createSocket = function createSocket(options, cb) {
|
||||
var self = this;
|
||||
var placeholder = {};
|
||||
self.sockets.push(placeholder);
|
||||
|
||||
var connectOptions = mergeOptions({}, self.proxyOptions, {
|
||||
method: 'CONNECT',
|
||||
path: options.host + ':' + options.port,
|
||||
agent: false,
|
||||
headers: {
|
||||
host: options.host + ':' + options.port
|
||||
}
|
||||
});
|
||||
if (options.localAddress) {
|
||||
connectOptions.localAddress = options.localAddress;
|
||||
}
|
||||
if (connectOptions.proxyAuth) {
|
||||
connectOptions.headers = connectOptions.headers || {};
|
||||
connectOptions.headers['Proxy-Authorization'] = 'Basic ' +
|
||||
new Buffer(connectOptions.proxyAuth).toString('base64');
|
||||
}
|
||||
|
||||
debug('making CONNECT request');
|
||||
var connectReq = self.request(connectOptions);
|
||||
connectReq.useChunkedEncodingByDefault = false; // for v0.6
|
||||
connectReq.once('response', onResponse); // for v0.6
|
||||
connectReq.once('upgrade', onUpgrade); // for v0.6
|
||||
connectReq.once('connect', onConnect); // for v0.7 or later
|
||||
connectReq.once('error', onError);
|
||||
connectReq.end();
|
||||
|
||||
function onResponse(res) {
|
||||
// Very hacky. This is necessary to avoid http-parser leaks.
|
||||
res.upgrade = true;
|
||||
}
|
||||
|
||||
function onUpgrade(res, socket, head) {
|
||||
// Hacky.
|
||||
process.nextTick(function() {
|
||||
onConnect(res, socket, head);
|
||||
});
|
||||
}
|
||||
|
||||
function onConnect(res, socket, head) {
|
||||
connectReq.removeAllListeners();
|
||||
socket.removeAllListeners();
|
||||
|
||||
if (res.statusCode !== 200) {
|
||||
debug('tunneling socket could not be established, statusCode=%d',
|
||||
res.statusCode);
|
||||
socket.destroy();
|
||||
var error = new Error('tunneling socket could not be established, ' +
|
||||
'statusCode=' + res.statusCode);
|
||||
error.code = 'ECONNRESET';
|
||||
options.request.emit('error', error);
|
||||
self.removeSocket(placeholder);
|
||||
return;
|
||||
}
|
||||
if (head.length > 0) {
|
||||
debug('got illegal response body from proxy');
|
||||
socket.destroy();
|
||||
var error = new Error('got illegal response body from proxy');
|
||||
error.code = 'ECONNRESET';
|
||||
options.request.emit('error', error);
|
||||
self.removeSocket(placeholder);
|
||||
return;
|
||||
}
|
||||
debug('tunneling connection has established');
|
||||
self.sockets[self.sockets.indexOf(placeholder)] = socket;
|
||||
return cb(socket);
|
||||
}
|
||||
|
||||
function onError(cause) {
|
||||
connectReq.removeAllListeners();
|
||||
|
||||
debug('tunneling socket could not be established, cause=%s\n',
|
||||
cause.message, cause.stack);
|
||||
var error = new Error('tunneling socket could not be established, ' +
|
||||
'cause=' + cause.message);
|
||||
error.code = 'ECONNRESET';
|
||||
options.request.emit('error', error);
|
||||
self.removeSocket(placeholder);
|
||||
}
|
||||
};
|
||||
|
||||
TunnelingAgent.prototype.removeSocket = function removeSocket(socket) {
|
||||
var pos = this.sockets.indexOf(socket)
|
||||
if (pos === -1) {
|
||||
return;
|
||||
}
|
||||
this.sockets.splice(pos, 1);
|
||||
|
||||
var pending = this.requests.shift();
|
||||
if (pending) {
|
||||
// If we have pending requests and a socket gets closed a new one
|
||||
// needs to be created to take over in the pool for the one that closed.
|
||||
this.createSocket(pending, function(socket) {
|
||||
pending.request.onSocket(socket);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function createSecureSocket(options, cb) {
|
||||
var self = this;
|
||||
TunnelingAgent.prototype.createSocket.call(self, options, function(socket) {
|
||||
var hostHeader = options.request.getHeader('host');
|
||||
var tlsOptions = mergeOptions({}, self.options, {
|
||||
socket: socket,
|
||||
servername: hostHeader ? hostHeader.replace(/:.*$/, '') : options.host
|
||||
});
|
||||
|
||||
// 0 is dummy port for v0.6
|
||||
var secureSocket = tls.connect(0, tlsOptions);
|
||||
self.sockets[self.sockets.indexOf(socket)] = secureSocket;
|
||||
cb(secureSocket);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function toOptions(host, port, localAddress) {
|
||||
if (typeof host === 'string') { // since v0.10
|
||||
return {
|
||||
host: host,
|
||||
port: port,
|
||||
localAddress: localAddress
|
||||
};
|
||||
}
|
||||
return host; // for v0.11 or later
|
||||
}
|
||||
|
||||
function mergeOptions(target) {
|
||||
for (var i = 1, len = arguments.length; i < len; ++i) {
|
||||
var overrides = arguments[i];
|
||||
if (typeof overrides === 'object') {
|
||||
var keys = Object.keys(overrides);
|
||||
for (var j = 0, keyLen = keys.length; j < keyLen; ++j) {
|
||||
var k = keys[j];
|
||||
if (overrides[k] !== undefined) {
|
||||
target[k] = overrides[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
|
||||
var debug;
|
||||
if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
||||
debug = function() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if (typeof args[0] === 'string') {
|
||||
args[0] = 'TUNNEL: ' + args[0];
|
||||
} else {
|
||||
args.unshift('TUNNEL:');
|
||||
}
|
||||
console.error.apply(console, args);
|
||||
}
|
||||
} else {
|
||||
debug = function() {};
|
||||
}
|
||||
exports.debug = debug; // for test
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -1128,8 +1393,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const main = __importStar(__webpack_require__(131));
|
||||
main.run();
|
||||
try {
|
||||
main.run();
|
||||
}
|
||||
catch (e) {
|
||||
core.setFailed(`Action failed with error ${e}`);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -1160,17 +1431,24 @@ module.exports = require("crypto");
|
||||
|
||||
"use strict";
|
||||
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const os = __webpack_require__(87);
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
* Command Format:
|
||||
* ##[name key=value;key=value]message
|
||||
* ::name key=value,key=value::message
|
||||
*
|
||||
* Examples:
|
||||
* ##[warning]This is the user warning message
|
||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
||||
* ::warning::This is the message
|
||||
* ::set-env name=MY_VAR::some value
|
||||
*/
|
||||
function issueCommand(command, properties, message) {
|
||||
const cmd = new Command(command, properties, message);
|
||||
@@ -1206,30 +1484,28 @@ class Command {
|
||||
else {
|
||||
cmdStr += ',';
|
||||
}
|
||||
// safely append the val - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
cmdStr += `${key}=${escape(`${val || ''}`)}`;
|
||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += CMD_STRING;
|
||||
// safely append the message - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
const message = `${this.message || ''}`;
|
||||
cmdStr += escapeData(message);
|
||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
function escapeData(s) {
|
||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
||||
return (s || '')
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escape(s) {
|
||||
return s
|
||||
function escapeProperty(s) {
|
||||
return (s || '')
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
.replace(/]/g, '%5D')
|
||||
.replace(/;/g, '%3B');
|
||||
.replace(/:/g, '%3A')
|
||||
.replace(/,/g, '%2C');
|
||||
}
|
||||
//# sourceMappingURL=command.js.map
|
||||
|
||||
@@ -2924,10 +3200,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = __webpack_require__(431);
|
||||
const os = __webpack_require__(87);
|
||||
const path = __webpack_require__(622);
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
@@ -3126,15 +3409,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __webpack_require__(470);
|
||||
const io = __webpack_require__(1);
|
||||
const fs = __webpack_require__(747);
|
||||
const os = __webpack_require__(87);
|
||||
const path = __webpack_require__(622);
|
||||
const httpm = __webpack_require__(539);
|
||||
const semver = __webpack_require__(550);
|
||||
const uuidV4 = __webpack_require__(826);
|
||||
const core = __importStar(__webpack_require__(470));
|
||||
const io = __importStar(__webpack_require__(1));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
const httpm = __importStar(__webpack_require__(539));
|
||||
const semver = __importStar(__webpack_require__(550));
|
||||
const v4_1 = __importDefault(__webpack_require__(826));
|
||||
const exec_1 = __webpack_require__(986);
|
||||
const assert_1 = __webpack_require__(357);
|
||||
class HTTPError extends Error {
|
||||
@@ -3188,7 +3481,7 @@ function downloadTool(url, dest) {
|
||||
allowRetries: true,
|
||||
maxRetries: 3
|
||||
});
|
||||
dest = dest || path.join(tempDirectory, uuidV4());
|
||||
dest = dest || path.join(tempDirectory, v4_1.default());
|
||||
yield io.mkdirP(path.dirname(dest));
|
||||
core.debug(`Downloading ${url}`);
|
||||
core.debug(`Downloading ${dest}`);
|
||||
@@ -3525,7 +3818,7 @@ function _createExtractFolder(dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!dest) {
|
||||
// create a temp dir
|
||||
dest = path.join(tempDirectory, uuidV4());
|
||||
dest = path.join(tempDirectory, v4_1.default());
|
||||
}
|
||||
yield io.mkdirP(dest);
|
||||
return dest;
|
||||
@@ -3594,7 +3887,6 @@ const url = __webpack_require__(835);
|
||||
const http = __webpack_require__(605);
|
||||
const https = __webpack_require__(211);
|
||||
const pm = __webpack_require__(950);
|
||||
let fs;
|
||||
let tunnel;
|
||||
var HttpCodes;
|
||||
(function (HttpCodes) {
|
||||
@@ -3625,6 +3917,15 @@ var HttpCodes;
|
||||
HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable";
|
||||
HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout";
|
||||
})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {}));
|
||||
/**
|
||||
* Returns the proxy URL, depending upon the supplied url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
function getProxyUrl(serverUrl) {
|
||||
let proxyUrl = pm.getProxyUrl(url.parse(serverUrl));
|
||||
return proxyUrl ? proxyUrl.href : '';
|
||||
}
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect];
|
||||
const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout];
|
||||
const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD'];
|
||||
@@ -3815,7 +4116,6 @@ class HttpClient {
|
||||
*/
|
||||
requestRawWithCallback(info, data, onResult) {
|
||||
let socket;
|
||||
let isDataString = typeof (data) === 'string';
|
||||
if (typeof (data) === 'string') {
|
||||
info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8');
|
||||
}
|
||||
@@ -3858,6 +4158,15 @@ class HttpClient {
|
||||
req.end();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets an http agent. This function is useful when you need an http agent that handles
|
||||
* routing through a proxy server - depending upon the url and proxy environment variables.
|
||||
* @param serverUrl The server URL where the request will be sent. For example, https://api.github.com
|
||||
*/
|
||||
getAgent(serverUrl) {
|
||||
let parsedUrl = url.parse(serverUrl);
|
||||
return this._getAgent(parsedUrl);
|
||||
}
|
||||
_prepareRequest(method, requestUrl, headers) {
|
||||
const info = {};
|
||||
info.parsedUrl = requestUrl;
|
||||
@@ -3911,7 +4220,7 @@ class HttpClient {
|
||||
if (useProxy) {
|
||||
// If using proxy, need tunnel
|
||||
if (!tunnel) {
|
||||
tunnel = __webpack_require__(157);
|
||||
tunnel = __webpack_require__(856);
|
||||
}
|
||||
const agentOptions = {
|
||||
maxSockets: maxSockets,
|
||||
@@ -5586,6 +5895,13 @@ module.exports = require("path");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 631:
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = require("net");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 669:
|
||||
/***/ (function(module) {
|
||||
|
||||
@@ -5906,6 +6222,14 @@ module.exports = v4;
|
||||
|
||||
module.exports = require("url");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 856:
|
||||
/***/ (function(module, __unusedexports, __webpack_require__) {
|
||||
|
||||
module.exports = __webpack_require__(141);
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 901:
|
||||
@@ -6051,23 +6375,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const url = __webpack_require__(835);
|
||||
function getProxyUrl(reqUrl) {
|
||||
let usingSsl = reqUrl.protocol === 'https:';
|
||||
let noProxy = process.env["no_proxy"] ||
|
||||
process.env["NO_PROXY"];
|
||||
let bypass;
|
||||
if (noProxy && typeof noProxy === 'string') {
|
||||
let bypassList = noProxy.split(',');
|
||||
for (let i = 0; i < bypassList.length; i++) {
|
||||
let item = bypassList[i];
|
||||
if (item &&
|
||||
typeof item === "string" &&
|
||||
reqUrl.host.toLocaleLowerCase() == item.trim().toLocaleLowerCase()) {
|
||||
bypass = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let proxyUrl;
|
||||
if (bypass) {
|
||||
if (checkBypass(reqUrl)) {
|
||||
return proxyUrl;
|
||||
}
|
||||
let proxyVar;
|
||||
@@ -6085,6 +6394,39 @@ function getProxyUrl(reqUrl) {
|
||||
return proxyUrl;
|
||||
}
|
||||
exports.getProxyUrl = getProxyUrl;
|
||||
function checkBypass(reqUrl) {
|
||||
if (!reqUrl.hostname) {
|
||||
return false;
|
||||
}
|
||||
let noProxy = process.env["no_proxy"] || process.env["NO_PROXY"] || '';
|
||||
if (!noProxy) {
|
||||
return false;
|
||||
}
|
||||
// Determine the request port
|
||||
let reqPort;
|
||||
if (reqUrl.port) {
|
||||
reqPort = Number(reqUrl.port);
|
||||
}
|
||||
else if (reqUrl.protocol === 'http:') {
|
||||
reqPort = 80;
|
||||
}
|
||||
else if (reqUrl.protocol === 'https:') {
|
||||
reqPort = 443;
|
||||
}
|
||||
// Format the request hostname and hostname with port
|
||||
let upperReqHosts = [reqUrl.hostname.toUpperCase()];
|
||||
if (typeof reqPort === 'number') {
|
||||
upperReqHosts.push(`${upperReqHosts[0]}:${reqPort}`);
|
||||
}
|
||||
// Compare request host against noproxy
|
||||
for (let upperNoProxyItem of noProxy.split(',').map(x => x.trim().toUpperCase()).filter(x => x)) {
|
||||
if (upperReqHosts.some(x => x === upperNoProxyItem)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
exports.checkBypass = checkBypass;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
7733
package-lock.json
generated
7733
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hugo-action",
|
||||
"version": "2.4.1",
|
||||
"name": "actions-hugo",
|
||||
"version": "2.4.4",
|
||||
"description": "GitHub Actions for Hugo",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
@@ -25,8 +25,7 @@
|
||||
"src/**/*.ts": [
|
||||
"prettier --check",
|
||||
"eslint",
|
||||
"jest --bail --findRelatedTests",
|
||||
"git add"
|
||||
"jest --bail --findRelatedTests"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
@@ -48,29 +47,29 @@
|
||||
},
|
||||
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.1",
|
||||
"@actions/core": "^1.2.2",
|
||||
"@actions/exec": "^1.0.3",
|
||||
"@actions/io": "^1.0.2",
|
||||
"@actions/tool-cache": "^1.3.0",
|
||||
"@actions/tool-cache": "^1.3.1",
|
||||
"node-fetch": "^2.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^24.9.0",
|
||||
"@types/node": "^13.1.7",
|
||||
"@types/jest": "^25.1.0",
|
||||
"@types/node": "^13.5.0",
|
||||
"@types/node-fetch": "^2.5.4",
|
||||
"@typescript-eslint/eslint-plugin": "^2.16.0",
|
||||
"@typescript-eslint/parser": "^2.16.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.18.0",
|
||||
"@typescript-eslint/parser": "^2.18.0",
|
||||
"@zeit/ncc": "^0.21.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-plugin-jest": "^23.6.0",
|
||||
"husky": "^4.0.10",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^24.9.0",
|
||||
"lint-staged": "^9.5.0",
|
||||
"husky": "^4.2.1",
|
||||
"jest": "^25.1.0",
|
||||
"jest-circus": "^25.1.0",
|
||||
"lint-staged": "^10.0.3",
|
||||
"nock": "^11.7.2",
|
||||
"prettier": "1.19.1",
|
||||
"standard-version": "^7.0.1",
|
||||
"ts-jest": "^24.3.0",
|
||||
"standard-version": "^7.1.0",
|
||||
"ts-jest": "^25.0.0",
|
||||
"typescript": "^3.7.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ fi
|
||||
|
||||
git fetch origin
|
||||
git pull origin master
|
||||
git tag -d v2
|
||||
git tag -d v2 || true
|
||||
git pull origin --tags
|
||||
|
||||
npm ci
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as main from './main';
|
||||
|
||||
main.run();
|
||||
try {
|
||||
main.run();
|
||||
} catch (e) {
|
||||
core.setFailed(`Action failed with error ${e}`);
|
||||
}
|
||||
|
||||
37
src/main.ts
37
src/main.ts
@@ -34,28 +34,23 @@ export async function showVersion(
|
||||
}
|
||||
|
||||
export async function run(): Promise<ActionResult> {
|
||||
try {
|
||||
const toolVersion: string = core.getInput('hugo-version');
|
||||
let installVersion = '';
|
||||
const toolVersion: string = core.getInput('hugo-version');
|
||||
let installVersion = '';
|
||||
|
||||
let result: ActionResult = {
|
||||
exitcode: 0,
|
||||
output: ''
|
||||
};
|
||||
let result: ActionResult = {
|
||||
exitcode: 0,
|
||||
output: ''
|
||||
};
|
||||
|
||||
if (toolVersion === '' || toolVersion === 'latest') {
|
||||
installVersion = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
||||
} else {
|
||||
installVersion = toolVersion;
|
||||
}
|
||||
|
||||
core.info(`${Tool.Name} version: ${installVersion}`);
|
||||
await installer(installVersion);
|
||||
result = await showVersion(Tool.CmdName, [Tool.CmdOptVersion]);
|
||||
|
||||
return result;
|
||||
} catch (e) {
|
||||
core.setFailed(`Action failed with error ${e}`);
|
||||
return e;
|
||||
if (toolVersion === '' || toolVersion === 'latest') {
|
||||
installVersion = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
||||
} else {
|
||||
installVersion = toolVersion;
|
||||
}
|
||||
|
||||
core.info(`${Tool.Name} version: ${installVersion}`);
|
||||
await installer(installVersion);
|
||||
result = await showVersion(Tool.CmdName, [Tool.CmdOptVersion]);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user