From 64d02b7bb40b24498757f03e3f8db52c709f5426 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Sun, 27 Oct 2024 15:11:10 +0100 Subject: [PATCH] chore: publish preview versions (#2335) --- .github/workflows/auto.yml | 2 + .github/workflows/ci.yml | 4 +- .github/workflows/compat.yml | 4 +- .github/workflows/lock-closed-issues.yml | 19 ++++++++ .github/workflows/release-preview.yml | 60 ++++++++++++++++++++++++ .github/workflows/release.yml | 9 ++-- .github/workflows/smoke-test.yml | 6 +-- .github/workflows/typescript-nightly.yml | 6 +-- decisions/releases.md | 6 ++- 9 files changed, 101 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/lock-closed-issues.yml create mode 100644 .github/workflows/release-preview.yml diff --git a/.github/workflows/auto.yml b/.github/workflows/auto.yml index 41dcf1438..72f2ba2a1 100644 --- a/.github/workflows/auto.yml +++ b/.github/workflows/auto.yml @@ -1,5 +1,7 @@ name: auto + on: [push] + jobs: cancel-previous-workflows: runs-on: macos-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0fa59640..312b5e3b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/.github/workflows/compat.yml b/.github/workflows/compat.yml index c331792d5..25ccd9296 100644 --- a/.github/workflows/compat.yml +++ b/.github/workflows/compat.yml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/.github/workflows/lock-closed-issues.yml b/.github/workflows/lock-closed-issues.yml new file mode 100644 index 000000000..0f50a7b50 --- /dev/null +++ b/.github/workflows/lock-closed-issues.yml @@ -0,0 +1,19 @@ +name: locked-closed-issues + +on: + schedule: + - cron: '0 0 * * *' + +permissions: + issues: write + +jobs: + action: + runs-on: macos-latest + steps: + - uses: dessant/lock-threads@v5 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + issue-inactive-days: '14' + issue-lock-reason: '' + process-only: 'issues' diff --git a/.github/workflows/release-preview.yml b/.github/workflows/release-preview.yml new file mode 100644 index 000000000..6fa1d8dc8 --- /dev/null +++ b/.github/workflows/release-preview.yml @@ -0,0 +1,60 @@ +name: release + +on: + pull_request_review: + types: [submitted] + workflow_dispatch: + +jobs: + check: + # Trigger the permissions check whenever someone approves a pull request. + # They must have the write permissions to the repo in order to + # trigger preview package publishing. + if: github.event.review.state == 'approved' + runs-on: ubuntu-latest + outputs: + has-permissions: ${{ steps.checkPermissions.outputs.require-result }} + steps: + - name: Check permissions + id: checkPermissions + uses: actions-cool/check-user-permission@v2 + with: + require: 'write' + + preview: + # The approving user must pass the permissions check + # to trigger the preview publish. + needs: check + if: needs.check.outputs.has-permissions == 'true' + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Set up pnpm + uses: pnpm/action-setup@v4 + with: + version: 8.15.6 + + - name: Install dependencies + run: pnpm install + + - name: Install Playwright browsers + run: pnpm exec playwright install + + - name: Lint + run: pnpm lint + + - name: Build + run: pnpm build + + - name: Tests + run: pnpm test + + - name: Publish preview + run: pnpm dlx pkg-pr-new@0.0 publish --compact --pnpm --comment=update diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e90648388..6a0bbfccb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,19 +13,20 @@ jobs: id-token: write steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.GH_ADMIN_TOKEN }} - - name: Setup Node.js - uses: actions/setup-node@v3 + - name: Set up Node.js + uses: actions/setup-node@v4 with: node-version: 18 always-auth: true registry-url: https://registry.npmjs.org - - uses: pnpm/action-setup@v4 + - name: Set up pnpm + uses: pnpm/action-setup@v4 with: version: 8.15.6 diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 18b124ffa..e98d4acad 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -15,14 +15,14 @@ jobs: runs-on: macos-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 - - name: Set up PNPM + - name: Set up pnpm uses: pnpm/action-setup@v4 with: version: 8.15.6 diff --git a/.github/workflows/typescript-nightly.yml b/.github/workflows/typescript-nightly.yml index 9449cd3ba..a292f12bb 100644 --- a/.github/workflows/typescript-nightly.yml +++ b/.github/workflows/typescript-nightly.yml @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest steps: - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 @@ -37,10 +37,10 @@ jobs: if: ${{ needs.compare.outputs.latest_version != needs.compare.outputs.rc_version }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 18 diff --git a/decisions/releases.md b/decisions/releases.md index 42dc3ead2..8a7a0d813 100644 --- a/decisions/releases.md +++ b/decisions/releases.md @@ -4,9 +4,13 @@ MSW uses the [Release](https://github.com/ossjs/release) library to automate its ## Release schedule -The next version of the library releases automatically **every 3 days**. +The next version of **the library releases automatically every day**. We do our best to choose the optimal release window to accumulate multiple changes under a single release. We do deviate from the release schedule in emergency cases, like when a critical issue has been fixed and needs an immediate release. > [!IMPORTANT] > Please do not ping the library maintainers to release a new version of MSW. Be patient and wait for the automated release to happen. Subscribe to any issue or pull request you are interested in, and you will be notified whenever it gets released. + +## Preview releases + +This repository is configured to **release work-in-progress pull requests** using [okg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new). Once the pull request in question is approved, it will automatically be published to a temporary registry. Follow the instructions in the automated comment to install the work-in-progress version of the package.