diff --git a/.github/workflows/release-dispatch.yml b/.github/workflows/release-dispatch.yml new file mode 100644 index 000000000..7294cd34c --- /dev/null +++ b/.github/workflows/release-dispatch.yml @@ -0,0 +1,42 @@ +name: release-dispatch +on: + workflow_dispatch: + inputs: + version: + description: Version to release + required: true + type: string + +jobs: + propose-release: + permissions: + pull-requests: write + contents: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Configure Git + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org/" + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: "8" + - name: Update Workspace Packages Version + run: | + VERSION=${{ github.event.inputs.version }} + pnpm -r exec -- bash -c "npm version $VERSION --no-git-tag-version" + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.CREATE_PR_TOKEN }} + title: "Prepare release: ${{ github.event.inputs.version }}" + commit-message: "Prepare release: ${{ github.event.inputs.version }}" + branch: "prepare-release-${{ github.event.inputs.version }}" + base: main + delete-branch: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..ecb2d0374 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Publish to npm + +on: + workflow_dispatch: + pull_request: + types: [closed] + branches: + - main + +jobs: + publish: + if: + (github.event.pull_request.merged == true && + github.event.pull_request.head.ref == 'prepare-release') || + github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org/" + + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: "8" + + - name: Install dependencies + run: pnpm install + + - name: Publish to npm + run: pnpm release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}