Fix duplicated dts jobs when matching special convention (#216) #471
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: | |
- main | |
tags: | |
- "v*" | |
pull_request: | |
jobs: | |
install_and_test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
node-version: [16, 18] | |
name: Node ${{ matrix.node-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: yarn | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Lint | |
run: | | |
yarn typecheck | |
yarn build | |
yarn test | |
release: | |
runs-on: ubuntu-latest | |
needs: [install_and_test] | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: yarn | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install Dependencies | |
run: yarn install --frozen-lockfile --prefer-offline | |
- name: Determine tag | |
id: determine_tag | |
run: | | |
echo "tag=$(echo $GITHUB_REF | grep -Eo 'alpha|beta|rc')" >> $GITHUB_OUTPUT | |
- name: Publish to versioned tag | |
if: steps.determine_tag.outputs.tag != '' | |
run: | | |
echo "Publishing to ${{ steps.determine_tag.outputs.tag }} tag" | |
npm publish --tag ${{ steps.determine_tag.outputs.tag }} | |
- name: Publish to latest | |
if: steps.determine_tag.outputs.tag == '' | |
run: | | |
echo "Publishing to latest" | |
npm publish |