Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: Add TypeScript Action (#83)
  • Loading branch information
Shohei Ueda authored and GitHub committed Feb 5, 2020
1 parent 28b05fd commit 68b21c1
Show file tree
Hide file tree
Showing 39 changed files with 9,269 additions and 241 deletions.
3 changes: 1 addition & 2 deletions .dependabot/config.yml
@@ -1,10 +1,9 @@
version: 1
update_configs:
- package_manager: "docker"
- package_manager: "javascript"
directory: "/"
update_schedule: "daily"
default_labels:
- "dependencies"
- "docker"
commit_message:
prefix: "deps"
9 changes: 2 additions & 7 deletions .dockerignore
@@ -1,7 +1,2 @@
.git
.github
.hadolint.yaml
LICENSE
README.md
action.yml
images
.*
*
13 changes: 13 additions & 0 deletions .editorconfig
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[Makefile]
indent_size = 4
indent_style = tab
3 changes: 3 additions & 0 deletions .envrc
@@ -0,0 +1,3 @@
nvmrc=~/.nvm/nvm.sh
source $nvmrc
nvm use
24 changes: 24 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,24 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2019
},
"rules": {
}
}
40 changes: 0 additions & 40 deletions .github/workflows/docker-image-ci.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,37 @@
name: Release

on:
push:
tags:
- 'v3.*.*'

jobs:
release:
runs-on: ubuntu-18.04
steps:

- uses: actions/checkout@v2

- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "${GITHUB_CONTEXT}"

- name: Install github/hub
run: |
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:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "See [CHANGELOG.md](https://github.com/${GITHUB_REPOSITORY}/blob/${TAG_NAME}/CHANGELOG.md) for more details." > ./release_notes.md
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 \
"${TAG_NAME}"
86 changes: 86 additions & 0 deletions .github/workflows/test-action.yml
@@ -0,0 +1,86 @@
name: Test Action

on:
push:
branches:
- master
paths-ignore:
- '*.md'
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '*.md'

jobs:
skipci:
runs-on: ubuntu-18.04
steps:
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"

test:
runs-on: ${{ matrix.os }}
if: contains(github.event.head_commit.message, '[skip ci]') == false
strategy:
matrix:
os:
- 'ubuntu-18.04'
# - 'macos-latest'
# - 'windows-latest'
steps:

- uses: actions/checkout@v2

- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- run: npm ci
- run: npm run build

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: '0.3.5'

- name: Build
working-directory: ./test_projects/mdbook
run: mdbook build

- name: Prepare tag
id: prepare_tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME="${GITHUB_REF##refs/tags/}"
echo "::set-output name=tag_name::${TAG_NAME}"
echo "::set-output name=deploy_tag_name::deploy-${TAG_NAME}"
- name: Deploy
uses: ./
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_branch: master
publish_dir: ./test_projects/mdbook/book
# external_repository: ''
allow_empty_commit: true
# keep_files: true
force_orphan: true
# user_name: iris
# user_email: email@peaceiris.com
# commit_message: ${{ github.event.head_commit.message }}
# tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }}
# tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}'

# - name: Deploy v2
# uses: peaceiris/actions-gh-pages@v2
# env:
# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# PUBLISH_BRANCH: gh-pages
# PUBLISH_DIR: ./test_projects/mdbook/book
64 changes: 64 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,64 @@
name: 'Test'

on:
push:
branches:
- master
paths-ignore:
- '*.md'
pull_request:
types:
- opened
- synchronize
paths-ignore:
- '*.md'

jobs:
skipci:
runs-on: ubuntu-18.04
steps:
- run: echo "[Skip CI] ${{ contains(github.event.head_commit.message, '[skip ci]') }}"

test:
runs-on: ${{ matrix.os }}
if: contains(github.event.head_commit.message, '[skip ci]') == false
strategy:
matrix:
os:
- 'ubuntu-18.04'
- 'macos-latest'
- 'windows-latest'
steps:

- uses: actions/checkout@v2

- name: Read .nvmrc
run: echo "::set-output name=NVMRC::$(cat .nvmrc)"
id: nvm

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- run: npm ci

- name: Run prettier
if: startsWith(matrix.os, 'ubuntu')
run: npm run format:check

- name: Run eslint
if: startsWith(matrix.os, 'ubuntu')
run: npm run lint

- name: Run ncc
if: startsWith(matrix.os, 'ubuntu')
run: npm run build

- run: npm test

- name: Upload test coverage as artifact
uses: actions/upload-artifact@v1
with:
name: coverage
path: coverage
5 changes: 2 additions & 3 deletions .github/workflows/update-major-tag.yml
Expand Up @@ -19,6 +19,5 @@ jobs:
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
export TAG_NAME="${GITHUB_REF##refs/tags/}"
export TAG_MAJOR="${TAG_NAME%%.*}"
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || git tag -d "${TAG_MAJOR}" ; git push --delete origin "${TAG_MAJOR}"
git tag "${TAG_MAJOR}" -m "Release ${TAG_NAME}" || true
git push origin "${TAG_MAJOR}"
git tag --force -a "${TAG_MAJOR}" -m "Release ${TAG_NAME}"
git push --force origin "${TAG_MAJOR}"
5 changes: 5 additions & 0 deletions .gitignore
@@ -1 +1,6 @@
.DS_Store
coverage
.npm
.eslintcache
.env
node_modules
2 changes: 0 additions & 2 deletions .hadolint.yaml

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
engine-strict=true
1 change: 1 addition & 0 deletions .nvmrc
@@ -0,0 +1 @@
12.14.1
11 changes: 11 additions & 0 deletions .prettierrc.json
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
3 changes: 3 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

0 comments on commit 68b21c1

Please sign in to comment.