From 8e11f0e1f4584da67c6df86a8eb96e97551a534e Mon Sep 17 00:00:00 2001 From: Hunter Tunnicliff Date: Tue, 17 Sep 2024 16:14:26 -0700 Subject: [PATCH] feat: configure package details --- .github/workflows/ci.yml | 8 +++-- .github/workflows/release.yml | 64 +++++++++++++++++++++++++++++++++++ .npmrc | 1 + package.json | 8 ++--- 4 files changed, 73 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6f56d47..89c4c7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,10 @@ name: CI -on: [push] +on: + pull_request: + merge_group: + types: [checks_requested] + workflow_call: jobs: build: @@ -8,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node: [18, 20, 22] + node: [20] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ace3507 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,64 @@ +name: Release + +on: + push: + branches: + - main + - next + - alpha + - beta + +concurrency: + group: publish-${{ github.ref }} + +env: + NODE_VERSION: 20 + +jobs: + verify: + name: Verify + uses: ./.github/workflows/ci.yml + + release: + name: Release + runs-on: ubuntu-latest + needs: [verify] + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Use Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Semantic Release + uses: cycjimmy/semantic-release-action@v3 + id: semantic + with: + # NOTE: ^19 is ESM and was causing a break + semantic_version: ^18 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'main', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + # Config override used disable features of @semantic-release/github causing rate limit + # @semantic-release/exec is installed internally + extends: | + @side/semantic-config-base + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc index 2402ba0..b588543 100644 --- a/.npmrc +++ b/.npmrc @@ -1,2 +1,3 @@ # Save exact versions save-exact=true +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/package.json b/package.json index d6dda07..751e77f 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,12 @@ { - "name": "swr-openapi", + "name": "@side/swr-openapi", "type": "module", "version": "5.0.0", "description": "Generate SWR hooks from OpenAPI schemas", "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/htunnicliff/swr-openapi.git" - }, - "funding": "https://github.com/sponsors/htunnicliff", - "author": { - "name": "Hunter Tunnicliff" + "url": "git+https://github.com/reside-eng/swr-openapi.git" }, "engines": { "node": ">=18"