From ffcf89710c636554d74fb7ddfeb10ae0415ace56 Mon Sep 17 00:00:00 2001 From: buck Date: Mon, 12 Feb 2024 16:20:20 -0600 Subject: [PATCH] add github workflows --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ .github/workflows/publish.yml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/version.yml | 31 +++++++++++++++++++++++++++++++ .npmrc | 1 + package.json | 7 +++++-- 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/version.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..efc1f996 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: Test + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: ["20.x"] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: npm ci + - name: Create Release Pull Request + uses: changesets/action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..0431cf36 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: Publish packages + +on: + release: + types: [published] + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Setup Node.js 20 + uses: actions/setup-node@v3 + with: + node-version: 20 + + - name: Install Dependencies + run: yarn + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: npm publish-packages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 00000000..c6befc75 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,31 @@ +name: Version + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Setup Node.js 20.x + uses: actions/setup-node@v3 + with: + node-version: 20.x + + - name: Install Dependencies + run: npm install + + - name: Create Release Pull Request + uses: changesets/action@v1 + with: + version: npm run version-packages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc index 214c29d1..cd9a5707 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ +//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN} registry=https://registry.npmjs.org/ diff --git a/package.json b/package.json index fa1b5030..566983c3 100644 --- a/package.json +++ b/package.json @@ -3,10 +3,13 @@ "private": true, "scripts": { "build": "turbo build", + "ci": "turbo run build lint test", "dev": "turbo dev", - "lint": "turbo lint", "format": "prettier --write \"**/*.{ts,tsx,md}\"", - "gen": "turbo gen run" + "gen": "turbo gen run", + "lint": "turbo lint", + "publish-packages": "turbo run build lint test && changeset publish", + "version-packages": "turbo run build lint test && changeset version" }, "devDependencies": { "@caravan/eslint-config": "*",