diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..b7eb57fb1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,46 @@ +name: Release + +on: + workflow_run: + workflows: ["CI"] + types: + - completed + branches: + - master + workflow_dispatch: + +permissions: + contents: write + id-token: write + +jobs: + release: + name: Release to npm + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'yarn' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build packages + run: yarn build + + - name: Publish to npm + if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + yarn lerna publish from-package --yes --no-verify-access diff --git a/lerna.json b/lerna.json index 3ac570d92..0f331bfe4 100644 --- a/lerna.json +++ b/lerna.json @@ -4,7 +4,15 @@ "version": "independent", "command": { "version": { - "allowBranch": "master" + "allowBranch": "master", + "conventionalCommits": true, + "message": "chore(release): publish", + "push": true, + "createRelease": false + }, + "publish": { + "ignoreChanges": ["**/*.md", "**/test/**", "**/*.test.*"], + "registry": "https://registry.npmjs.org/" } }, "ignoreChanges": ["**/*.md", "**/test/**"]