Skip to content

Commit 68b21c1

Browse files
authored
feat: Add TypeScript Action (#83)
cf. https://github.com/peaceiris/actions-github-pages Close #54
1 parent 28b05fd commit 68b21c1

39 files changed

+9269
-241
lines changed

.dependabot/config.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
version: 1
22
update_configs:
3-
- package_manager: "docker"
3+
- package_manager: "javascript"
44
directory: "/"
55
update_schedule: "daily"
66
default_labels:
77
- "dependencies"
8-
- "docker"
98
commit_message:
109
prefix: "deps"

.dockerignore

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,2 @@
1-
.git
2-
.github
3-
.hadolint.yaml
4-
LICENSE
5-
README.md
6-
action.yml
7-
images
1+
.*
2+
*

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[Makefile]
12+
indent_size = 4
13+
indent_style = tab

.envrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nvmrc=~/.nvm/nvm.sh
2+
source $nvmrc
3+
nvm use

.eslintrc.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"env": {
3+
"commonjs": true,
4+
"es6": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:jest/recommended"
12+
],
13+
"globals": {
14+
"Atomics": "readonly",
15+
"SharedArrayBuffer": "readonly"
16+
},
17+
"parser": "@typescript-eslint/parser",
18+
"parserOptions": {
19+
"sourceType": "module",
20+
"ecmaVersion": 2019
21+
},
22+
"rules": {
23+
}
24+
}

.github/workflows/docker-image-ci.yml

-40
This file was deleted.

.github/workflows/release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v3.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
13+
- uses: actions/checkout@v2
14+
15+
- name: Dump GitHub context
16+
env:
17+
GITHUB_CONTEXT: ${{ toJson(github) }}
18+
run: echo "${GITHUB_CONTEXT}"
19+
20+
- name: Install github/hub
21+
run: |
22+
export HUB_VERSION="2.14.1"
23+
curl -fsSL https://github.com/github/hub/raw/40e421edd2c63d57bb8daa4bb9bbdfa21e8becf9/script/get | bash -s "${HUB_VERSION}"
24+
25+
- name: Create release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
TAG_NAME="${GITHUB_REF##refs/tags/}"
30+
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md
31+
RELEASE_NAME="$(jq -r '.name' ./package.json)"
32+
sed -i "1i${RELEASE_NAME} ${TAG_NAME}\n" ./release_notes.md
33+
./bin/hub release create \
34+
--draft \
35+
--prerelease \
36+
--file ./release_notes.md \
37+
"${TAG_NAME}"

.github/workflows/test-action.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Test Action
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '*.md'
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
paths-ignore:
14+
- '*.md'
15+
16+
jobs:
17+
skipci:
18+
runs-on: ubuntu-18.04
19+
steps:
20+
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
21+
22+
test:
23+
runs-on: ${{ matrix.os }}
24+
if: contains(github.event.head_commit.message, '[skip ci]') == false
25+
strategy:
26+
matrix:
27+
os:
28+
- 'ubuntu-18.04'
29+
# - 'macos-latest'
30+
# - 'windows-latest'
31+
steps:
32+
33+
- uses: actions/checkout@v2
34+
35+
- name: Read .nvmrc
36+
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
37+
id: nvm
38+
39+
- name: Setup Node
40+
uses: actions/setup-node@v1
41+
with:
42+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
43+
44+
- run: npm ci
45+
- run: npm run build
46+
47+
- name: Setup mdBook
48+
uses: peaceiris/actions-mdbook@v1
49+
with:
50+
mdbook-version: '0.3.5'
51+
52+
- name: Build
53+
working-directory: ./test_projects/mdbook
54+
run: mdbook build
55+
56+
- name: Prepare tag
57+
id: prepare_tag
58+
if: startsWith(github.ref, 'refs/tags/')
59+
run: |
60+
TAG_NAME="${GITHUB_REF##refs/tags/}"
61+
echo "::set-output name=tag_name::${TAG_NAME}"
62+
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
63+
64+
- name: Deploy
65+
uses: ./
66+
with:
67+
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
68+
# github_token: ${{ secrets.GITHUB_TOKEN }}
69+
# publish_branch: master
70+
publish_dir: ./test_projects/mdbook/book
71+
# external_repository: ''
72+
allow_empty_commit: true
73+
# keep_files: true
74+
force_orphan: true
75+
# user_name: iris
76+
# user_email: [email protected]
77+
# commit_message: ${{ github.event.head_commit.message }}
78+
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
79+
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'
80+
81+
# - name: Deploy v2
82+
# uses: peaceiris/actions-gh-pages@v2
83+
# env:
84+
# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
85+
# PUBLISH_BRANCH: gh-pages
86+
# PUBLISH_DIR: ./test_projects/mdbook/book

.github/workflows/test.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: 'Test'
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths-ignore:
8+
- '*.md'
9+
pull_request:
10+
types:
11+
- opened
12+
- synchronize
13+
paths-ignore:
14+
- '*.md'
15+
16+
jobs:
17+
skipci:
18+
runs-on: ubuntu-18.04
19+
steps:
20+
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"
21+
22+
test:
23+
runs-on: ${{ matrix.os }}
24+
if: contains(github.event.head_commit.message, '[skip ci]') == false
25+
strategy:
26+
matrix:
27+
os:
28+
- 'ubuntu-18.04'
29+
- 'macos-latest'
30+
- 'windows-latest'
31+
steps:
32+
33+
- uses: actions/checkout@v2
34+
35+
- name: Read .nvmrc
36+
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
37+
id: nvm
38+
39+
- name: Setup Node
40+
uses: actions/setup-node@v1
41+
with:
42+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
43+
44+
- run: npm ci
45+
46+
- name: Run prettier
47+
if: startsWith(matrix.os, 'ubuntu')
48+
run: npm run format:check
49+
50+
- name: Run eslint
51+
if: startsWith(matrix.os, 'ubuntu')
52+
run: npm run lint
53+
54+
- name: Run ncc
55+
if: startsWith(matrix.os, 'ubuntu')
56+
run: npm run build
57+
58+
- run: npm test
59+
60+
- name: Upload test coverage as artifact
61+
uses: actions/upload-artifact@v1
62+
with:
63+
name: coverage
64+
path: coverage

.github/workflows/update-major-tag.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ jobs:
1919
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
2020
export TAG_NAME="${GITHUB_REF##refs/tags/}"
2121
export TAG_MAJOR="${TAG_NAME%%.*}"
22-
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || git tag -d "${TAG_MAJOR}" ; git push --delete origin "${TAG_MAJOR}"
23-
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || true
24-
git push origin "${TAG_MAJOR}"
22+
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
23+
git push --force origin "${TAG_MAJOR}"

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
.DS_Store
2+
coverage
3+
.npm
4+
.eslintcache
5+
.env
6+
node_modules

.hadolint.yaml

-2
This file was deleted.

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
engine-strict=true

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12.14.1

.prettierrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"git.ignoreLimitWarning": true
3+
}

0 commit comments

Comments
 (0)