diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..34fdba6b4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Changesets +on: + workflow_dispatch: + inputs: + level: + description: 'Release type' + required: true + default: 'preview' + type: choice + options: + - preview + - general availability +env: + CI: true + PNPM_CACHE_FOLDER: .pnpm-store +jobs: + version: + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - name: checkout code repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: setup node.js + uses: actions/setup-node@v3 + with: + node-version: 14 + - name: install pnpm + run: npm i pnpm@latest -g + - name: Setup npmrc + run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc + - name: setup pnpm config + run: pnpm config set store-dir $PNPM_CACHE_FOLDER + - name: install dependencies + run: pnpm install + - name: set pre-release + if: ${{ inputs.level }} == 'preview' + run: pnpm changeset pre enter rc + - name: create and publish versions + uses: changesets/action@v1 + with: + version: pnpm ci:version + commit: "chore: update versions" + title: "chore: update versions" + publish: pnpm ci:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 97d78943d..6db779e08 100644 --- a/README.md +++ b/README.md @@ -36,3 +36,14 @@ This monorepo uses [pnpm](https://pnpm.io/), make sure to install it first if yo ## License Dual licensed under [MIT](LICENSE-MIT) and [Apache 2](LICENSE-APACHE) + +## Releasing + +To perform a release, you must first generate a changeset. Create a branch, e.g. `chore-release`, and then generate your +changeset + + pnpm changeset + +Commit this changeset, push the branch, and then merge the branch. + +Once merged, run the release action. Choose `pre-release` or `release` depending on whether the release is a preview release diff --git a/package.json b/package.json index c13cde5dc..2a61edc11 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "test:ci": "turbo run test:ci", "lint": "turbo run lint", "build": "pnpm --filter \"@composedb/*\" build:types && turbo run build:js", - "prepare": "pnpm build" + "prepare": "pnpm build", + "ci:version": "pnpm changeset version", + "ci:publish": "pnpm publish -r" }, "devDependencies": { "@changesets/cli": "^2.26.2",