This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
chore: bump dependencies and fix code style (#181) #255
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: CI | |
on: | |
push: | |
branches: | |
# Match SemVer major release branches, e.g. "2.x" or ".x" | |
- '[0-9]+.x' | |
- 'main' | |
- 'next' | |
- 'alpha' | |
- 'beta' | |
- '!all-contributors/**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
DEFAULT_NODE_VERSION: 18.x | |
jobs: | |
setup: | |
name: Setup | |
strategy: | |
matrix: | |
node_version: [18.x, 20.x] | |
os: [ ubuntu-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ matrix.node_version }}' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{matrix.node_version}}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci --ignore-scripts && npm run postinstall | |
eslint: | |
name: Eslint | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: [18.x, 20.x] | |
needs: [setup] | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ matrix.node_version }}' | |
- name: Fetch all branches | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{matrix.node_version}}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: ESLint | |
run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx') | |
typescript: | |
name: Typescript | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node_version: [18.x, 20.x] | |
needs: [setup] | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ matrix.node_version }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{matrix.node_version}}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: Typescript | |
run: npm run ci:tsc | |
test: | |
name: Test | |
strategy: | |
matrix: | |
node_version: [18.x, 20.x] | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
needs: [setup] | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ matrix.node_version }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{matrix.node_version}}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: Test | |
run: npm run test | |
release: | |
needs: [test] | |
if: github.event_name == 'push' && github.repository == 'smeijer/unimported' | |
runs-on: ubuntu-latest | |
environment: npm | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/cancel-workflow-action@0.9.0 | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '${{ env.DEFAULT_NODE_VERSION }}' | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{env.DEFAULT_NODE_VERSION}}-node_modules-${{ hashFiles('package-lock.json') }} | |
- name: Build | |
run: npm run build | |
- name: Release | |
uses: cycjimmy/semantic-release-action@v2 | |
with: | |
semantic_version: 17 | |
branches: | | |
[ | |
'+([0-9])?(.{+([0-9]),x}).x', | |
'main', | |
'next', | |
{ name: 'alpha', prerelease: true }, | |
{ name: 'beta', prerelease: true } | |
] | |
env: | |
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |