diff --git a/.github/workflows/release_publish.yaml b/.github/workflows/release_publish.yaml new file mode 100644 index 0000000..e3d63c1 --- /dev/null +++ b/.github/workflows/release_publish.yaml @@ -0,0 +1,42 @@ +name: Release and Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.17' + registry-url: 'https://registry.npmjs.org' + + - name: use pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Cache pnpm modules + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm- + + - name: Install dependencies + run: pnpm install + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + publish: pnpm release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 9bb1d7f..79c3a7e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "dev": "turbo run dev", "build": "turbo run build", "test": "turbo run test", - "format": "prettier --write ." + "format": "prettier --write .", + "release": "turbo run test build && changeset version && changeset publish" }, "devDependencies": { "@changesets/cli": "^2.26.2",