chore: fix ref_name #300
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: | |
pull_request: | |
branches: [main] | |
jobs: | |
lint: | |
name: 'Lint' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install deps | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Lint | |
run: yarn lint | |
build-and-test: | |
name: 'Build and Test' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install deps | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Build | |
run: yarn build | |
- name: Test browsers | |
run: yarn test:browser | |
- name: Test Node from .nvmrc | |
run: yarn test:nodejs | |
- name: Switch to Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Test Node 20 | |
run: yarn test:nodejs | |
- name: Switch to Node 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Test Node 18 | |
run: yarn test:nodejs | |
- name: Switch to Node 16 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
- name: Test Node 16 | |
run: yarn test:nodejs | |
- name: Switch to Node 14 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '14' | |
- name: Test Node 14 | |
run: yarn test:nodejs | |
- name: Switch to Node 12 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '12' | |
- name: Test Node 12 | |
run: yarn test:nodejs | |
release: | |
name: Semantic release | |
needs: [lint, build-and-test] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/cache@v4 | |
env: | |
cache-name: cache-node_modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install deps | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: yarn install --frozen-lockfile | |
- name: Release dry-run | |
if: github.event_name != 'push' || github.ref != 'refs/heads/main' | |
run: yarn release --dry-run --no-ci --branches "${{ github.ref_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: yarn release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |