diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 834bae0c..080fd791 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ -name: Main CI +name: CI -on: [push] +on: [push, workflow_call] jobs: lint: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e45dfb02..a0cf304d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,58 +3,11 @@ name: Release on: workflow_dispatch jobs: - lint: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - name: Install dependencies - run: pnpm install - - name: Build - run: pnpm build - - name: Lint - run: pnpm lint - - typecheck: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - name: Install dependencies - run: pnpm install - - name: Build - run: pnpm build - - name: Type Check - run: pnpm typecheck - - tests: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - run: corepack enable - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'pnpm' - - name: Install dependencies - run: pnpm install - - name: Build - run: pnpm build - - name: Test - run: pnpm test + checks: + uses: ./.github/workflows/ci.yml release: + needs: checks runs-on: ubuntu-latest steps: - name: Checkout code @@ -66,12 +19,15 @@ jobs: cache: 'pnpm' - name: Install dependencies run: pnpm install - - name: create and publish versions - uses: changesets/action@v1 - with: - version: pnpm ci:version - commit: 'chore(release): update versions' - publish: pnpm ci:publish + - name: Tag and Release + run: | + pnpm ci:version + git add . + git commit -m "chore(release): publish" + pnpm get-tag + git tag "$(<./version.output.txt)" + pnpm ci:publish + git push && git push --tags env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index e083b003..3d600f02 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ dist lerna-debug.log packages/*/dist/** packages/*/src/playground.ts +version.output.txt diff --git a/package.json b/package.json index 5a693a48..d84d9a30 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "dev": "tsx scripts/watch.ts", "prepare": "husky", "ci:publish": "pnpm build && pnpm publish --provenance --access public -r", - "ci:version": "pnpm changeset version && cp ./packages/core/CHANGELOG.md ./CHANGELOG.md" + "ci:version": "pnpm changeset version && cp ./packages/core/CHANGELOG.md ./CHANGELOG.md", + "get-tag": "tsx ./scripts/get-tag.ts" }, "devDependencies": { "@changesets/cli": "^2.27.8", diff --git a/scripts/get-tag.ts b/scripts/get-tag.ts new file mode 100644 index 00000000..fd9f8069 --- /dev/null +++ b/scripts/get-tag.ts @@ -0,0 +1,4 @@ +import { version } from '../packages/core/package.json'; +import fs from 'fs'; + +fs.writeFileSync('version.output.txt', `v${version}`);