mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 20:32:19 +01:00
Compare commits
30 Commits
v2.4.12
...
peaceiris-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28797ce1ee | ||
|
|
cef7a7b43d | ||
|
|
da2d5466d3 | ||
|
|
71f80aff9f | ||
|
|
3f02ff7a9e | ||
|
|
87ff7f6586 | ||
|
|
18a17a77a8 | ||
|
|
483f8d1e34 | ||
|
|
c83f10804e | ||
|
|
cf40bc8ca5 | ||
|
|
2fa902b35f | ||
|
|
16d8ce1cd5 | ||
|
|
1835230a2b | ||
|
|
f1c7ecda61 | ||
|
|
96f56dee02 | ||
|
|
863939f1a7 | ||
|
|
00ad5734ff | ||
|
|
eb88818df9 | ||
|
|
45f920d29b | ||
|
|
d59d21e633 | ||
|
|
e4507caf0b | ||
|
|
f42b9853d3 | ||
|
|
638096b27f | ||
|
|
53a8986af5 | ||
|
|
838268abaf | ||
|
|
9f4ef016d6 | ||
|
|
8bff475612 | ||
|
|
be3787356a | ||
|
|
919a5f9b0b | ||
|
|
20fdc5a174 |
1
.github/dependabot.yml
vendored
1
.github/dependabot.yml
vendored
@@ -6,7 +6,6 @@ updates:
|
|||||||
interval: daily
|
interval: daily
|
||||||
time: '11:00'
|
time: '11:00'
|
||||||
timezone: Japan
|
timezone: Japan
|
||||||
open-pull-requests-limit: 1
|
|
||||||
labels:
|
labels:
|
||||||
- "dependencies"
|
- "dependencies"
|
||||||
ignore:
|
ignore:
|
||||||
|
|||||||
2
.github/label-commenter-config.yml
vendored
2
.github/label-commenter-config.yml
vendored
@@ -9,7 +9,7 @@ labels:
|
|||||||
issue:
|
issue:
|
||||||
body: |
|
body: |
|
||||||
Please ask questions about GitHub Actions or Hugo at the following forum.
|
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/)
|
- [Hugo Community Forum](https://discourse.gohugo.io/)
|
||||||
action: close
|
action: close
|
||||||
- name: wontfix
|
- name: wontfix
|
||||||
|
|||||||
29
.github/workflows/codeql-analysis.yml
vendored
Normal file
29
.github/workflows/codeql-analysis.yml
vendored
Normal 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
|
||||||
2
.github/workflows/dev-image.yml
vendored
2
.github/workflows/dev-image.yml
vendored
@@ -3,7 +3,7 @@ name: 'Dev Image CI'
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
paths:
|
paths:
|
||||||
- '.github/workflows/dev-image.yml'
|
- '.github/workflows/dev-image.yml'
|
||||||
- '.dockerignore'
|
- '.dockerignore'
|
||||||
|
|||||||
4
.github/workflows/label-commenter.yml
vendored
4
.github/workflows/label-commenter.yml
vendored
@@ -16,10 +16,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: main
|
||||||
|
|
||||||
- name: Label Commenter
|
- name: Label Commenter
|
||||||
uses: peaceiris/actions-label-commenter@v1
|
uses: peaceiris/actions-label-commenter@v1.3.7
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# config_file: .github/label-commenter-config.yml
|
# config_file: .github/label-commenter-config.yml
|
||||||
|
|||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -3,7 +3,7 @@ name: 'Test'
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '**.md'
|
- '**.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
id: nvm
|
id: nvm
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v2.0.0
|
uses: actions/setup-node@v2.1.0
|
||||||
with:
|
with:
|
||||||
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
node-version: '${{ steps.nvm.outputs.NVMRC }}'
|
||||||
|
|
||||||
@@ -56,6 +56,6 @@ jobs:
|
|||||||
name: coverage-${{ matrix.os }}
|
name: coverage-${{ matrix.os }}
|
||||||
path: coverage
|
path: coverage
|
||||||
|
|
||||||
- uses: codecov/codecov-action@v1.0.7
|
- uses: codecov/codecov-action@v1.0.10
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"printWidth": 80,
|
"printWidth": 100,
|
||||||
"tabWidth": 2,
|
"tabWidth": 2,
|
||||||
"useTabs": false,
|
"useTabs": false,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
"trailingComma": "none",
|
"trailingComma": "none",
|
||||||
"bracketSpacing": false,
|
"bracketSpacing": false,
|
||||||
"arrowParens": "avoid",
|
"arrowParens": "avoid",
|
||||||
"parser": "typescript"
|
"parser": "typescript"
|
||||||
}
|
}
|
||||||
|
|||||||
24
README.md
24
README.md
@@ -1,11 +1,11 @@
|
|||||||
[](https://github.com/peaceiris/actions-hugo/blob/master/LICENSE)
|
[](https://github.com/peaceiris/actions-hugo/blob/main/LICENSE)
|
||||||
[](https://github.com/peaceiris/actions-hugo/releases/latest)
|
[](https://github.com/peaceiris/actions-hugo/releases/latest)
|
||||||
[](https://github.com/peaceiris/actions-hugo/releases)
|
[](https://github.com/peaceiris/actions-hugo/releases)
|
||||||
[](https://github.com/peaceiris/actions-hugo/releases.atom)
|
[](https://github.com/peaceiris/actions-hugo/releases.atom)
|
||||||

|

|
||||||
|
|
||||||
[](https://www.codefactor.io/repository/github/peaceiris/actions-hugo)
|
[](https://www.codefactor.io/repository/github/peaceiris/actions-hugo)
|
||||||
[](https://codecov.io/gh/peaceiris/actions-hugo)
|
[](https://codecov.io/gh/peaceiris/actions-hugo)
|
||||||
[](https://codeclimate.com/github/peaceiris/actions-hugo/maintainability)
|
[](https://codeclimate.com/github/peaceiris/actions-hugo/maintainability)
|
||||||
|
|
||||||
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
|
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
|
||||||
@@ -75,7 +75,7 @@ name: github pages
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.71.1'
|
hugo-version: '0.74.1'
|
||||||
# extended: true
|
# extended: true
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
@@ -118,7 +118,7 @@ Set `extended: true` to use a Hugo extended version.
|
|||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.71.1'
|
hugo-version: '0.74.1'
|
||||||
extended: true
|
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.
|
Write a `HUGO_VERSION` to the `.env` file like the following and push it to a remote branch.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
HUGO_VERSION=0.71.1
|
HUGO_VERSION=0.74.1
|
||||||
```
|
```
|
||||||
|
|
||||||
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.
|
||||||
@@ -210,7 +210,7 @@ name: github pages
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -224,7 +224,7 @@ jobs:
|
|||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.71.1'
|
hugo-version: '0.74.1'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
@@ -259,7 +259,7 @@ name: github pages
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
@@ -273,7 +273,7 @@ jobs:
|
|||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.71.1'
|
hugo-version: '0.74.1'
|
||||||
extended: true
|
extended: true
|
||||||
|
|
||||||
- name: Setup Ruby
|
- name: Setup Ruby
|
||||||
@@ -310,7 +310,7 @@ jobs:
|
|||||||
|
|
||||||
- [MIT License - peaceiris/actions-hugo]
|
- [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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,15 +27,9 @@ describe('getURL()', () => {
|
|||||||
|
|
||||||
describe('getLatestVersion()', () => {
|
describe('getLatestVersion()', () => {
|
||||||
test('return latest version via brew', async () => {
|
test('return latest version via brew', async () => {
|
||||||
nock('https://formulae.brew.sh')
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
|
||||||
.reply(200, jsonTestBrew);
|
|
||||||
|
|
||||||
const versionLatest: string = await getLatestVersion(
|
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'brew');
|
||||||
Tool.Org,
|
|
||||||
Tool.Repo,
|
|
||||||
'brew'
|
|
||||||
);
|
|
||||||
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -44,21 +38,13 @@ describe('getLatestVersion()', () => {
|
|||||||
.get(`/repos/${Tool.Org}/${Tool.Repo}/releases/latest`)
|
.get(`/repos/${Tool.Org}/${Tool.Repo}/releases/latest`)
|
||||||
.reply(200, jsonTestGithub);
|
.reply(200, jsonTestGithub);
|
||||||
|
|
||||||
const versionLatest: string = await getLatestVersion(
|
const versionLatest: string = await getLatestVersion(Tool.Org, Tool.Repo, 'github');
|
||||||
Tool.Org,
|
|
||||||
Tool.Repo,
|
|
||||||
'github'
|
|
||||||
);
|
|
||||||
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
expect(versionLatest).toMatch(Tool.TestVersionLatest);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('return exception 404', async () => {
|
test('return exception 404', async () => {
|
||||||
nock('https://formulae.brew.sh')
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
|
||||||
.reply(404);
|
|
||||||
|
|
||||||
await expect(
|
await expect(getLatestVersion(Tool.Org, Tool.Repo, 'brew')).rejects.toThrowError(FetchError);
|
||||||
getLatestVersion(Tool.Org, Tool.Repo, 'brew')
|
|
||||||
).rejects.toThrowError(FetchError);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,8 +2,7 @@ import getURL from '../src/get-url';
|
|||||||
|
|
||||||
describe('getURL()', () => {
|
describe('getURL()', () => {
|
||||||
test('test', () => {
|
test('test', () => {
|
||||||
const baseURL =
|
const baseURL = 'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
||||||
'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
|
||||||
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
||||||
const urlLinuxExtended = `${baseURL}/hugo_extended_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`;
|
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ describe('Integration testing run()', () => {
|
|||||||
test('succeed in installing a custom version', async () => {
|
test('succeed in installing a custom version', async () => {
|
||||||
const testVersion = Tool.TestVersionSpec;
|
const testVersion = Tool.TestVersionSpec;
|
||||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||||
|
process.env['INPUT_EXTENDED'] = 'false';
|
||||||
const result: main.ActionResult = await main.run();
|
const result: main.ActionResult = await main.run();
|
||||||
expect(result.exitcode).toBe(0);
|
expect(result.exitcode).toBe(0);
|
||||||
expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`);
|
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 () => {
|
test('succeed in installing the latest version', async () => {
|
||||||
const testVersion = 'latest';
|
const testVersion = 'latest';
|
||||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||||
nock('https://formulae.brew.sh')
|
process.env['INPUT_EXTENDED'] = 'false';
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||||
.reply(200, jsonTestBrew);
|
|
||||||
const result: main.ActionResult = await main.run();
|
const result: main.ActionResult = await main.run();
|
||||||
expect(result.exitcode).toBe(0);
|
expect(result.exitcode).toBe(0);
|
||||||
expect(result.output).toMatch(
|
expect(result.output).toMatch(`Hugo Static Site Generator v${Tool.TestVersionLatest}`);
|
||||||
`Hugo Static Site Generator v${Tool.TestVersionLatest}`
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('succeed in installing the latest extended version', async () => {
|
test('succeed in installing the latest extended version', async () => {
|
||||||
const testVersion = 'latest';
|
const testVersion = 'latest';
|
||||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||||
process.env['INPUT_EXTENDED'] = 'true';
|
process.env['INPUT_EXTENDED'] = 'true';
|
||||||
nock('https://formulae.brew.sh')
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
|
||||||
.reply(200, jsonTestBrew);
|
|
||||||
const result: main.ActionResult = await main.run();
|
const result: main.ActionResult = await main.run();
|
||||||
expect(result.exitcode).toBe(0);
|
expect(result.exitcode).toBe(0);
|
||||||
expect(result.output).toMatch(
|
expect(result.output).toMatch(`Hugo Static Site Generator v${Tool.TestVersionLatest}`);
|
||||||
`Hugo Static Site Generator v${Tool.TestVersionLatest}`
|
|
||||||
);
|
|
||||||
expect(result.output).toMatch(`extended`);
|
expect(result.output).toMatch(`extended`);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('fail to install the latest version due to 404 of brew', async () => {
|
test('fail to install the latest version due to 404 of brew', async () => {
|
||||||
process.env['INPUT_HUGO-VERSION'] = 'latest';
|
process.env['INPUT_HUGO-VERSION'] = 'latest';
|
||||||
nock('https://formulae.brew.sh')
|
process.env['INPUT_EXTENDED'] = 'false';
|
||||||
.get(`/api/formula/${Tool.Repo}.json`)
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
||||||
.reply(404);
|
|
||||||
|
|
||||||
await expect(main.run()).rejects.toThrowError(FetchError);
|
await expect(main.run()).rejects.toThrowError(FetchError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -91,8 +83,6 @@ describe('showVersion()', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('return not found', async () => {
|
test('return not found', async () => {
|
||||||
await expect(
|
await expect(main.showVersion('gitgit', ['--version'])).rejects.toThrowError(Error);
|
||||||
main.showVersion('gitgit', ['--version'])
|
|
||||||
).rejects.toThrowError(Error);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
7018
lib/index.js
7018
lib/index.js
File diff suppressed because it is too large
Load Diff
1288
package-lock.json
generated
1288
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@@ -27,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"src/**/*.ts": [
|
"{src,__tests__}/**/*.ts": [
|
||||||
"prettier --check",
|
"prettier --check",
|
||||||
"eslint"
|
"eslint"
|
||||||
],
|
],
|
||||||
@@ -57,26 +57,26 @@
|
|||||||
"@actions/core": "^1.2.4",
|
"@actions/core": "^1.2.4",
|
||||||
"@actions/exec": "^1.0.4",
|
"@actions/exec": "^1.0.4",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^1.5.5",
|
"@actions/tool-cache": "^1.6.0",
|
||||||
"node-fetch": "^2.6.0"
|
"node-fetch": "^2.6.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^26.0.0",
|
"@types/jest": "^26.0.4",
|
||||||
"@types/node": "~12",
|
"@types/node": "~12",
|
||||||
"@types/node-fetch": "^2.5.7",
|
"@types/node-fetch": "^2.5.7",
|
||||||
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||||
"@typescript-eslint/parser": "^2.34.0",
|
"@typescript-eslint/parser": "^2.34.0",
|
||||||
"@zeit/ncc": "^0.22.3",
|
"@zeit/ncc": "^0.22.3",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-jest": "^23.13.2",
|
"eslint-plugin-jest": "^23.18.0",
|
||||||
"husky": "^4.2.5",
|
"husky": "^4.2.5",
|
||||||
"jest": "^25.5.4",
|
"jest": "^25.5.4",
|
||||||
"jest-circus": "^26.0.1",
|
"jest-circus": "^26.1.0",
|
||||||
"lint-staged": "^10.2.11",
|
"lint-staged": "^10.2.11",
|
||||||
"nock": "^12.0.3",
|
"nock": "^13.0.2",
|
||||||
"prettier": "2.0.5",
|
"prettier": "2.0.5",
|
||||||
"standard-version": "^8.0.0",
|
"standard-version": "^8.0.2",
|
||||||
"ts-jest": "^25.5.1",
|
"ts-jest": "^25.5.1",
|
||||||
"typescript": "^3.9.5"
|
"typescript": "^3.9.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
release.sh
10
release.sh
@@ -3,8 +3,10 @@
|
|||||||
# fail on unset variables and command errors
|
# fail on unset variables and command errors
|
||||||
set -eu -o pipefail # -x: is for debugging
|
set -eu -o pipefail # -x: is for debugging
|
||||||
|
|
||||||
if [ "$(git branch --show-current)" != "master" ]; then
|
DEFAULT_BRANCH="main"
|
||||||
echo "$0: Current branch is not master" 1>&2
|
|
||||||
|
if [ "$(git branch --show-current)" != "${DEFAULT_BRANCH}" ]; then
|
||||||
|
echo "$0: Current branch is not ${DEFAULT_BRANCH}" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -26,7 +28,7 @@ if [ "${res}" = "n" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
git fetch origin
|
git fetch origin
|
||||||
git pull origin master
|
git pull origin "${DEFAULT_BRANCH}"
|
||||||
git tag -d v2 || true
|
git tag -d v2 || true
|
||||||
git pull origin --tags
|
git pull origin --tags
|
||||||
|
|
||||||
@@ -44,5 +46,5 @@ rm -rf ./lib
|
|||||||
git commit -m "chore(release): Remove build assets [skip ci]"
|
git commit -m "chore(release): Remove build assets [skip ci]"
|
||||||
|
|
||||||
TAG_NAME="v$(jq -r '.version' ./package.json)"
|
TAG_NAME="v$(jq -r '.version' ./package.json)"
|
||||||
git push origin master
|
git push origin "${DEFAULT_BRANCH}"
|
||||||
git push origin "${TAG_NAME}"
|
git push origin "${TAG_NAME}"
|
||||||
|
|||||||
@@ -12,11 +12,7 @@ export function getURL(org: string, repo: string, api: string): string {
|
|||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLatestVersion(
|
export async function getLatestVersion(org: string, repo: string, api: string): Promise<string> {
|
||||||
org: string,
|
|
||||||
repo: string,
|
|
||||||
api: string
|
|
||||||
): Promise<string> {
|
|
||||||
const url = getURL(org, repo, api);
|
const url = getURL(org, repo, api);
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
export default function getURL(
|
export default function getURL(os: string, extended: string, version: string): string {
|
||||||
os: string,
|
|
||||||
extended: string,
|
|
||||||
version: string
|
|
||||||
): string {
|
|
||||||
const extendedStr = (extended: string): string => {
|
const extendedStr = (extended: string): string => {
|
||||||
if (extended === 'true') {
|
if (extended === 'true') {
|
||||||
return 'extended_';
|
return 'extended_';
|
||||||
} else {
|
} else if (extended === 'false') {
|
||||||
return '';
|
return '';
|
||||||
// } else {
|
} else {
|
||||||
// throw new Error(`Invalid input (extended): ${extended}`);
|
throw new Error(`Invalid input (extended): ${extended}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -59,16 +59,10 @@ export async function installer(version: string): Promise<void> {
|
|||||||
const toolAssets: string = await tc.downloadTool(toolURL);
|
const toolAssets: string = await tc.downloadTool(toolURL);
|
||||||
let toolBin = '';
|
let toolBin = '';
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
const toolExtractedFolder: string = await tc.extractZip(
|
const toolExtractedFolder: string = await tc.extractZip(toolAssets, tempDir);
|
||||||
toolAssets,
|
|
||||||
tempDir
|
|
||||||
);
|
|
||||||
toolBin = `${toolExtractedFolder}/${Tool.CmdName}.exe`;
|
toolBin = `${toolExtractedFolder}/${Tool.CmdName}.exe`;
|
||||||
} else {
|
} else {
|
||||||
const toolExtractedFolder: string = await tc.extractTar(
|
const toolExtractedFolder: string = await tc.extractTar(toolAssets, tempDir);
|
||||||
toolAssets,
|
|
||||||
tempDir
|
|
||||||
);
|
|
||||||
toolBin = `${toolExtractedFolder}/${Tool.CmdName}`;
|
toolBin = `${toolExtractedFolder}/${Tool.CmdName}`;
|
||||||
}
|
}
|
||||||
await io.mv(toolBin, binDir);
|
await io.mv(toolBin, binDir);
|
||||||
|
|||||||
@@ -9,10 +9,7 @@ export interface ActionResult {
|
|||||||
output: string;
|
output: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function showVersion(
|
export async function showVersion(cmd: string, args: string[]): Promise<ActionResult> {
|
||||||
cmd: string,
|
|
||||||
args: string[]
|
|
||||||
): Promise<ActionResult> {
|
|
||||||
const result: ActionResult = {
|
const result: ActionResult = {
|
||||||
exitcode: 0,
|
exitcode: 0,
|
||||||
output: ''
|
output: ''
|
||||||
|
|||||||
Reference in New Issue
Block a user