Merge pull request #179 from YutaUra/nextjs_app_dynamic_href #524
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: "Test on Node:${{ matrix.node-version }} OS:${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
node-version: [14, 16, 18] | |
os: [ubuntu-latest] | |
include: | |
- os: windows-latest | |
node-version: 16 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: setup Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: "node_modules" | |
key: ${{ runner.os }}-node-v${{ matrix.node-version }}-yarn-${{ hashFiles('yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
- run: yarn lint | |
if: matrix.os != 'windows-latest' | |
- run: yarn typecheck | |
- run: yarn test --coverage | |
- run: npx codecov | |
if: github.ref == 'refs/heads/main' && matrix.os == 'ubuntu-latest' && matrix.node-version == 16 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
release: | |
runs-on: ubuntu-latest | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: "https://registry.npmjs.org" | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: "node_modules" | |
key: ${{ runner.os }}-node-v16-yarn-${{ hashFiles('yarn.lock') }} | |
- run: yarn --frozen-lockfile | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
- run: yarn build | |
- run: | | |
VERSION="$(node -e 'console.log(process.argv[1].match(/^refs\/tags\/v(\d+\.\d+\.\d+)$/)[1])' "${{ github.ref }}")" | |
node -e 'console.log(JSON.stringify({...require("./package.json"),version:process.argv[1]}, null, 2))' "$VERSION" | tee ./tmp-package.json | |
mv ./tmp-package.json ./package.json | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |