Skip to content

Switch from yarn to pnpm, improve workflows, add provenance to published package #1863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/actions/set-up-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "Set up Node.js"
inputs:
node-version:
default: "lts/*"
registry-url:
default: ""
runs:
using: "composite"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Set up Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
registry-url: ${{ inputs.registry-url }}
cache: "pnpm"
- name: Install dependencies
shell: bash
run: pnpm install
16 changes: 8 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: 'monthly'
interval: "monthly"
labels:
- 'skip-changelog'
- 'dependencies'
- "skip-changelog"
- "dependencies"
rebase-strategy: disabled

- package-ecosystem: npm
directory: '/'
directory: "/"

schedule:
interval: 'monthly'
time: '04:00'
interval: "monthly"
time: "04:00"
open-pull-requests-limit: 10
labels:
- skip-changelog
Expand Down
44 changes: 22 additions & 22 deletions .github/release-draft-template.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
name-template: 'v$RESOLVED_VERSION 🌻'
tag-template: 'v$RESOLVED_VERSION'
name-template: "v$RESOLVED_VERSION 🌻"
tag-template: "v$RESOLVED_VERSION"
exclude-labels:
- 'skip-changelog'
- "skip-changelog"
version-resolver:
minor:
labels:
- 'breaking-change'
- "breaking-change"
default: patch
categories:
- title: '⚠️ Breaking changes'
label: 'breaking-change'
- title: '🚀 Enhancements'
label: 'enhancement'
- title: '🐛 Bug Fixes'
label: 'bug'
- title: '🔒 Security'
label: 'security'
- title: '⚙️ Maintenance/misc'
- title: "⚠️ Breaking changes"
label: "breaking-change"
- title: "🚀 Enhancements"
label: "enhancement"
- title: "🐛 Bug Fixes"
label: "bug"
- title: "🔒 Security"
label: "security"
- title: "⚙️ Maintenance/misc"
label:
- 'maintenance'
- 'documentation'
- "maintenance"
- "documentation"
template: |
$CHANGES

Thanks again to $CONTRIBUTORS! 🎉
no-changes-template: 'Changes are coming soon 😎'
sort-direction: 'ascending'
no-changes-template: "Changes are coming soon 😎"
sort-direction: "ascending"
replacers:
- search: '/(?:and )?@dependabot-preview(?:\[bot\])?,?/g'
replace: ''
replace: ""
- search: '/(?:and )?@dependabot(?:\[bot\])?,?/g'
replace: ''
replace: ""
- search: '/(?:and )?@bors(?:\[bot\])?,?/g'
replace: ''
- search: '/(?:and )?@meili-bot,?/g'
replace: ''
replace: ""
- search: "/(?:and )?@meili-bot,?/g"
replace: ""
10 changes: 3 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@ on:
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: yarn install
- uses: actions/checkout@v4
- uses: ./.github/actions/set-up-node

- name: Generate Documentation
run: yarn build:docs
run: pnpm build:docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
Expand Down
37 changes: 17 additions & 20 deletions .github/workflows/meilisearch-prototype-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ name: Meilisearch prototype tests
on:
pull_request:
branches:
- 'prototype-beta/**'
- "prototype-beta/**"
push:
branches:
- 'prototype-beta/**'
- "prototype-beta/**"

jobs:
meilisearch-version:
Expand All @@ -31,37 +31,34 @@ jobs:
echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT
integration_tests:
runs-on: ubuntu-latest
needs: ['meilisearch-version']
needs: ["meilisearch-version"]
services:
meilisearch:
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
MEILI_MASTER_KEY: "masterKey"
MEILI_NO_ANALYTICS: "true"
ports:
- '7700:7700'
- "7700:7700"
strategy:
matrix:
node: ['18', '20', '22']
name: integration-tests (Node.js ${{ matrix.node }})
node-version: ["18", "20", "22"]
name: integration-tests (Node.js ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
- uses: ./.github/actions/set-up-node
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Install dependencies
run: yarn --dev
node-version: ${{ matrix.node-version }}

- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
41 changes: 19 additions & 22 deletions .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ name: Pre-Release Tests
on:
pull_request:
branches:
- 'bump-meilisearch-v**'
- 'pre-release-beta/**'
- "bump-meilisearch-v**"
- "pre-release-beta/**"
push:
branches:
- 'bump-meilisearch-v**'
- 'pre-release-beta/**'
- "bump-meilisearch-v**"
- "pre-release-beta/**"

jobs:
meilisearch-version:
Expand All @@ -28,37 +28,34 @@ jobs:
integration_tests:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'bump-meilisearch-v') || startsWith(github.base_ref, 'pre-release-beta')
needs: ['meilisearch-version']
needs: ["meilisearch-version"]
services:
meilisearch:
image: getmeili/meilisearch:${{ needs.meilisearch-version.outputs.version }}
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
MEILI_MASTER_KEY: "masterKey"
MEILI_NO_ANALYTICS: "true"
ports:
- '7700:7700'
- "7700:7700"
strategy:
matrix:
node: ['18', '20', '22']
name: integration-tests (Node.js ${{ matrix.node }})
node-version: ["18", "20", "22"]
name: integration-tests (Node.js ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
- uses: ./.github/actions/set-up-node
with:
node-version: ${{ matrix.node }}
cache: yarn
- name: Install dependencies
run: yarn --dev
node-version: ${{ matrix.node-version }}

- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
29 changes: 15 additions & 14 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@ on:
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org/
cache: 'yarn'
- name: Check release validity
run: sh .github/scripts/check-release.sh
- name: Check tag format
run: sh .github/scripts/check-tag-format.sh "${{ github.event.release.prerelease }}"
- name: Install dependencies
run: yarn install

- uses: ./.github/actions/set-up-node
with:
registry-url: https://registry.npmjs.org/

- name: Build meilisearch-js
run: yarn build
run: pnpm build
- name: Publish with latest tag
if: '!github.event.release.prerelease'
run: npm publish .
if: !github.event.release.prerelease
run: pnpm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish with beta tag
if: 'github.event.release.prerelease'
run: npm publish . --tag beta
if: github.event.release.prerelease
run: pnpm publish --provenance --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
55 changes: 21 additions & 34 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,33 @@ jobs:
meilisearch:
image: getmeili/meilisearch:latest
env:
MEILI_MASTER_KEY: 'masterKey'
MEILI_NO_ANALYTICS: 'true'
MEILI_MASTER_KEY: "masterKey"
MEILI_NO_ANALYTICS: "true"
ports:
- '7700:7700'
- "7700:7700"
strategy:
fail-fast: false
matrix:
node: ['18', '20', '22']
name: integration-tests (Node.js ${{ matrix.node }})
node-version: ["18", "20", "22"]
name: integration-tests (Node.js ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
- uses: ./.github/actions/set-up-node
with:
node-version: ${{ matrix.node }}
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
node-version: ${{ matrix.node-version }}

- name: Run tests
run: yarn test
run: pnpm test
- name: Build project
run: yarn build
run: pnpm build
- name: Run ESM env
run: yarn test:env:esm
run: pnpm test:env:esm
- name: Run Node.js env
run: yarn test:env:nodejs
run: pnpm test:env:nodejs
- name: Run node typescript env
run: yarn test:env:node-ts
run: pnpm test:env:node-ts
- name: Run Browser env
run: yarn test:env:browser
run: pnpm test:env:browser
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
Expand All @@ -66,15 +63,10 @@ jobs:
name: style-check
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
- uses: ./.github/actions/set-up-node

- name: Run code style check
run: yarn style
run: pnpm style
- name: Run yaml style check
uses: ibiqlik/action-yamllint@v3
with:
Expand All @@ -84,14 +76,9 @@ jobs:
name: types-check
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'yarn'
- name: Install dependencies
run: yarn --dev
- uses: ./.github/actions/set-up-node

- name: Build project
run: yarn build
run: pnpm build
- name: Run types check
run: yarn types
run: pnpm types
Loading
Loading