Skip to content

Commit 5d25b37

Browse files
authored
Merge pull request #6 from NCTUCSUnion/dev
chore: migrate project to pnpm, add semantic-release configuration, a…
2 parents 628d064 + 27946dd commit 5d25b37

10 files changed

Lines changed: 5027 additions & 4977 deletions

File tree

.github/workflows/main.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,31 @@ jobs:
2020
uses: actions/setup-node@v4
2121
with:
2222
node-version: "18"
23-
cache: "npm"
24-
cache-dependency-path: frontend/package-lock.json
23+
24+
- name: Setup pnpm
25+
uses: pnpm/action-setup@v4
26+
with:
27+
version: 9
28+
29+
- name: Get pnpm store directory
30+
shell: bash
31+
run: |
32+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33+
34+
- name: Setup pnpm cache
35+
uses: actions/cache@v4
36+
with:
37+
path: ${{ env.STORE_PATH }}
38+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39+
restore-keys: |
40+
${{ runner.os }}-pnpm-store-
2541
2642
- name: Install frontend dependencies
27-
run: npm ci
43+
run: pnpm install --frozen-lockfile
2844
working-directory: ./frontend
2945

3046
- name: Run lint
31-
run: npm run lint
47+
run: pnpm run lint
3248
working-directory: ./frontend
3349

3450
build-and-deploy:

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
issues: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: "pnpm"
26+
27+
- name: Setup pnpm
28+
uses: pnpm/action-setup@v4
29+
with:
30+
version: 9
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Release
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
run: npx semantic-release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44

55
.DS_Store
66

7+
node_modules/
78
backup/

.releaserc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"branches": ["main"],
3+
"tagFormat": "v${version}",
4+
"plugins": [
5+
"@semantic-release/commit-analyzer",
6+
"@semantic-release/release-notes-generator",
7+
"@semantic-release/github"
8+
]
9+
}

frontend/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
FROM node:18-alpine AS build
22
WORKDIR /app
3+
4+
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
5+
36
ARG VITE_API_BASE_URL
47
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
5-
COPY package*.json ./
6-
RUN npm ci
8+
9+
COPY package.json pnpm-lock.yaml ./
10+
11+
RUN pnpm install --frozen-lockfile
12+
713
COPY . .
14+
815
RUN echo "VITE_API_BASE_URL=${VITE_API_BASE_URL}" > .env
9-
RUN npm run build
16+
RUN pnpm run build
1017

1118
FROM nginx:alpine
1219
COPY --from=build /app/dist /usr/share/nginx/html

0 commit comments

Comments
 (0)