From 41e161113a105d32d458d18f9bf32e8df3ef22c2 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Thu, 5 Mar 2026 07:29:44 +0100 Subject: [PATCH 1/3] Chore: update release process --- .github/workflows/release.yml | 100 +++++++++++++++++++++++++++++++++ .github/workflows/validate.yml | 69 ++++------------------- 2 files changed, 112 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e5cbbe7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: release +on: + push: + branches: + # Match SemVer major release branches + # e.g. "12.x" or "8.x" + - '[0-9]+.x' + - 'main' + - 'next' + - 'next-major' + - 'beta' + - 'alpha' + - '!all-contributors/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + validate: + permissions: + contents: read # to fetch code (actions/checkout) + # ignore all-contributors PRs + if: ${{ !contains(github.head_ref, 'all-contributors') }} + strategy: + fail-fast: false + matrix: + node: [20, 22, 24] + runs-on: ubuntu-latest + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: ⎔ Setup node + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: ▶️ Run validate script + run: npm run validate + + - name: ⬆️ Upload coverage report + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: true + flags: node-${{ matrix.node }} + token: ${{ secrets.CODECOV_TOKEN }} + + release: + permissions: + id-token: write # to enable use of OIDC (npm trusted publishing and provenance) + actions: write # to cancel/stop running workflows + contents: write # to create release tags + issues: write # to post release notes that resolve issues + pull-requests: write # to comment on released pull requests + + needs: validate + runs-on: ubuntu-latest + if: + ${{ github.repository == 'testing-library/preact-testing-library' && + github.event_name == 'push' }} + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + + - name: ⎔ Setup node + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: 📥 Download deps + uses: bahmutov/npm-install@v1 + with: + useLockFile: false + + - name: 🏗 Run build script + run: npm run build + + - name: 🚀 Release + uses: cycjimmy/semantic-release-action@v5 + with: + semantic_version: 25 + branches: | + [ + '+([0-9])?(.{+([0-9]),x}).x', + 'main', + 'next', + 'next-major', + {name: 'beta', prerelease: true}, + {name: 'alpha', prerelease: true} + ] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 91533e4..0d7b91f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,34 +1,30 @@ name: validate on: - push: - branches: - - '+([0-9])?(.{+([0-9]),x}).x' - - 'main' - - 'next' - - 'next-major' - - 'beta' - - 'alpha' - - '!all-contributors/**' pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +permissions: {} + jobs: main: + permissions: + contents: read # to fetch code (actions/checkout) # ignore all-contributors PRs if: ${{ !contains(github.head_ref, 'all-contributors') }} strategy: + fail-fast: false matrix: - node: [16, 18, 20] + node: [20, 22, 24] runs-on: ubuntu-latest steps: - name: ⬇️ Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: ⎔ Setup node - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} @@ -36,54 +32,13 @@ jobs: uses: bahmutov/npm-install@v1 with: useLockFile: false - env: - HUSKY_SKIP_INSTALL: true - name: ▶️ Run validate script run: npm run validate - name: ⬆️ Upload coverage report - uses: codecov/codecov-action@v2 - - release: - needs: main - runs-on: ubuntu-latest - if: - ${{ github.repository == 'testing-library/preact-testing-library' && - contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', github.ref) && - github.event_name == 'push' }} - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v2 - - - name: ⎔ Setup node - uses: actions/setup-node@v2 - with: - node-version: 14 - - - name: 📥 Download deps - uses: bahmutov/npm-install@v1 - with: - useLockFile: false - env: - HUSKY_SKIP_INSTALL: true - - - name: 🏗 Run build script - run: npm run build - - - name: 🚀 Release - uses: cycjimmy/semantic-release-action@v2 + uses: codecov/codecov-action@v5 with: - semantic_version: 17 - branches: | - [ - '+([0-9])?(.{+([0-9]),x}).x', - 'main', - 'next', - 'next-major', - {name: 'beta', prerelease: true}, - {name: 'alpha', prerelease: true} - ] - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + fail_ci_if_error: true + flags: node-${{ matrix.node }} + token: ${{ secrets.CODECOV_TOKEN }} From 527db6b232b704258b4fb62cf5ce8d3bb1bcf275 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Thu, 5 Mar 2026 07:34:53 +0100 Subject: [PATCH 2/3] Add explicit coverage flag --- .github/workflows/release.yml | 13 +++++++++++-- .github/workflows/validate.yml | 13 +++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5cbbe7..f72be8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,17 @@ jobs: with: useLockFile: false - - name: ▶️ Run validate script - run: npm run validate + - name: 🧹 Run lint script + run: npm run lint + + - name: 🧪 Run tests with coverage + run: npm test -- --coverage + + - name: 🧼 Run clean script + run: npm run clean + + - name: 🏗 Run build script + run: npm run build - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v5 diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 0d7b91f..a62857c 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -33,8 +33,17 @@ jobs: with: useLockFile: false - - name: ▶️ Run validate script - run: npm run validate + - name: 🧹 Run lint script + run: npm run lint + + - name: 🧪 Run tests with coverage + run: npm test -- --coverage + + - name: 🧼 Run clean script + run: npm run clean + + - name: 🏗 Run build script + run: npm run build - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v5 From 8df74697b8cc2131c5b1f6cb4dd76d5bbd53aff1 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Thu, 5 Mar 2026 07:37:07 +0100 Subject: [PATCH 3/3] Temp skip coverage upload because of invalid token --- .github/workflows/release.yml | 2 +- .github/workflows/validate.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f72be8b..9c4ce76 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v5 with: - fail_ci_if_error: true + fail_ci_if_error: false # Temp because token is invalid flags: node-${{ matrix.node }} token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index a62857c..48bc1b3 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -48,6 +48,6 @@ jobs: - name: ⬆️ Upload coverage report uses: codecov/codecov-action@v5 with: - fail_ci_if_error: true + fail_ci_if_error: false # Temp because token is invalid flags: node-${{ matrix.node }} token: ${{ secrets.CODECOV_TOKEN }}