From 3925ff8906545d7c58e6fbafe1649bd43ad2c4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ari=20Perkki=C3=B6?= Date: Sat, 9 Aug 2025 15:25:52 +0300 Subject: [PATCH] ci: setup publish workflow --- .github/workflows/publish.yml | 67 +++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2c57ca7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,67 @@ +name: CI + +on: + workflow_dispatch: + inputs: + release-type: + type: choice + description: Type of the release + options: + - patch + - minor + - major + +permissions: + contents: read + id-token: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: pnpm/action-setup@v2 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: 'https://registry.npmjs.org' + + # OICD requires updated npm even when pnpm is used + - name: Update npm + run: | + npm --version + npm install -g npm@latest + npm --version + + - name: Install Dependencies + run: pnpm install + + - name: Build + run: pnpm build + + - name: Typecheck + run: pnpm typecheck + + - name: Lint + run: pnpm lint + + - 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