Skip to content

🔧 add pnpm on ci

🔧 add pnpm on ci #4

Workflow file for this run

name: Continuous Integration
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_TLS_REJECT_UNAUTHORIZED: 0
on:
pull_request:
push:
workflow_dispatch:
jobs:
pre_ci:
name: Prepare CI environment
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: "[Push] Get commit message"
if: github.event_name == 'push'
id: push_get_commit_message
run: echo "push_commit_message=$(git log --format=%B -n 1 HEAD)" >> $GITHUB_STATE
- name: "[Pull Request] Get commit message"
if: github.event_name == 'pull_request'
id: pr_get_commit_message
run: echo "pr_commit_message=$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_STATE
outputs:
commit_message: $( [ -z "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" ] && echo "${{ steps.push_get_commit_message.outputs.push_commit_message }}" || echo "${{ steps.pr_get_commit_message.outputs.pr_commit_message }}" )
lint:
name: Linting
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Restore NodeJS Cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-20-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm i --frozen-lockfile
- name: Run Biome
run: pnpm lint
build:
name: Compiling source code
runs-on: ubuntu-latest
if: "!contains(needs.pre_ci.outputs.commit_message, '[skip ci]')"
needs: pre_ci
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Restore NodeJS Cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-20-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Install Dependencies
run: pnpm i --frozen-lockfile
- name: Compiling source code
run: |
if [ "${{ github.ref }}" != "refs/heads/main" ]; then
cp .env.development .env.production
fi
pnpm build