chore(deps): update npm #391
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build, lint, and test | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm build | |
| - name: Lint | |
| run: pnpm lint | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Test | |
| run: pnpm test | |
| test-fail: | |
| name: Test Fail | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: failure() && !cancelled() && needs.test.result == 'failure' && github.event_name == 'pull_request' && (github.event.pull_request.user.login == 'dependabot[bot]' || github.event.pull_request.user.login == 'renovate[bot]') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ secrets.WORKFLOW_PAT }} | |
| fetch-depth: 0 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: latest | |
| cache: pnpm | |
| - name: Set up Bun # Bun is the only way I can run the script that generates the map with such an import statement with | |
| uses: oven-sh/setup-bun@v2 # it's also the fastest runtime and is 100% compatible with Node sooo 🤷♂️ | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Empty replacements file | |
| # This is necessary because we want to regenerate the entire map | |
| run: echo "export default {};" > src/renamedReplacements.js | |
| - name: Create Vitest report | |
| run: pnpm vitest --reporter=json --outputFile=out.json || true | |
| - name: Replace the map | |
| run: | | |
| map=$(bun --bun run scripts/renaming-map-from-test.js) | |
| echo "export default $map" > src/renamedReplacements.js | |
| - name: Remove the output file | |
| run: rm -f out.json || true | |
| - name: Upgrade Lucide | |
| run: pnpm up -L lucide-svelte | |
| - name: Bump the version in package.json | |
| run: | | |
| jq '.version |= (split(".") | .[2] = (. [2] | tonumber + 1) | join("."))' package.json > package.json.tmp | |
| mv package.json.tmp package.json | |
| - name: Formatting | |
| run: pnpm format | |
| - name: Commit and push the changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add src/renamedReplacements.js package.json pnpm-lock.yaml | |
| git commit --amend -m "chore(release): update the replacements map" | |
| git checkout ${{ github.event.repository.default_branch }} | |
| git merge ${{ github.head_ref }} | |
| git push origin ${{ github.event.repository.default_branch }}:${{ github.event.repository.default_branch }} |