diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..07eb202 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,39 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + node-version: [18, 20, 22] + + steps: + - uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Set node version to ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install & Build + run: | + pnpm install + pnpm build + + - name: Typecheck + run: pnpm typecheck + + - name: Test + run: pnpm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..284d487 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,58 @@ +name: Publish + +on: + workflow_dispatch: + inputs: + release-type: + type: choice + description: Type of the release + options: + - patch + - minor + - major + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - uses: actions/setup-node@v4 + with: + node-version: "20" + registry-url: "https://registry.npmjs.org" + + - name: Install & Build + run: | + pnpm install + pnpm build + + - name: Typecheck + run: pnpm typecheck + + - name: Test + run: pnpm test + + - name: Configure github-actions git + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@users.noreply.github.com' + + - name: Bump version + run: pnpm version ${{ github.event.inputs.release-type }} + + - name: Push release tag + run: git push origin main --follow-tags + + - name: Publish to npm + run: pnpm publish --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}