Skip to content
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

ci: use corepack to automatically handle pnpm version & use GitHub composite actions #568

Merged
merged 4 commits into from
May 25, 2024
Merged
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
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup
description: Installs Node, Enables Corepack and caches pnpm.

runs:
using: composite

steps:
- name: Enable corepack
run: corepack enable
shell: bash
MuhammadM1998 marked this conversation as resolved.
Show resolved Hide resolved

- name: Setup node & pnpm
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: pnpm
28 changes: 3 additions & 25 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,10 @@ jobs:

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

# Run a build step here
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 9.1.2
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup (Install Node & pnpm)
uses: ./.github/actions/setup

- name: Install dependencies
run: pnpm i --frozen-lockfile
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup (Install Node & pnpm)
uses: ./.github/actions/setup

- run: npx changelogithub
- run: pnpm dlx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27 changes: 3 additions & 24 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 9.1.2
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Setup (Install Node & pnpm)
uses: ./.github/actions/setup

- name: Install dependencies
run: pnpm i --frozen-lockfile
Expand Down