Skip to content

Commit

Permalink
Refactor the use of actions/setup-node (#545)
Browse files Browse the repository at this point in the history
- Set `.nvmrc` value to `with.node-version`
  See <actions/setup-node#32 (comment)>
- Add `npm run lint-ci` to use "Problem Matchers" of actions/setup-node
  • Loading branch information
ybiquitous committed Jul 7, 2021
1 parent f0e5eb3 commit 9632b30
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/eslint.yml
Expand Up @@ -12,8 +12,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
id: nvm
- uses: actions/setup-node@v2
with:
node-version: "16.x"
node-version: "${{ steps.nvm.outputs.nvmrc }}"
- run: npm install eslint-config-ybiquitous @typescript-eslint/eslint-plugin
- run: npx eslint .
4 changes: 4 additions & 0 deletions .github/workflows/stylelint.yml
Expand Up @@ -12,7 +12,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
id: nvm
- uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.nvmrc }}"
# https://github.com/actions/toolkit/blob/2f164000dcd42fb08287824a3bc3030dbed33687/docs/commands.md#problem-matchers
# https://gist.github.com/ybiquitous/184a337662bfcafdd3d227253f9401ff
- name: Set up Problem Matchers for stylelint
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/test.yml
Expand Up @@ -11,16 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
nvm install --latest-npm --no-progress
echo "PATH=${NVM_BIN}:${PATH}" >> $GITHUB_ENV
shell: bash --login {0}
- run: echo ::set-output name=nvmrc::$(cat .nvmrc)
id: nvm
- uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.nvmrc }}"
- run: npm ci
- name: Set up Problem Matchers for tsc
run: |
curl -fLO "https://raw.githubusercontent.com/actions/setup-node/5c355be17065acf11598c7a9bb47112fbcf2bbdc/.github/tsc.json"
mv tsc.json "${HOME}/tsc.json"
echo "::add-matcher::${HOME}/tsc.json"
- run: npm run lint:types
- run: npm run lint
- run: npm run lint-ci
- run: npm run build
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -8,6 +8,7 @@
"postbuild": "cp -v _redirects dist/",
"static": "npm run build && npx http-server ./dist",
"format": "npm-run-all --print-label --parallel lint:*:fix prettier:write",
"lint-ci": "npm-run-all --silent --parallel lint:* prettier:check",
"lint": "npm-run-all --print-label --parallel lint:* prettier:check",
"lint:md": "remark .",
"lint:md:fix": "remark . --output",
Expand Down

0 comments on commit 9632b30

Please sign in to comment.