Skip to content

Commit 61b4931

Browse files
authored
Update dependencies and modernize CI/CD workflow (#82)
- Fixed TypeScript 5.x compatibility issues - Updated GitHub Actions workflow with better testing and deployment separation - Improved Docker build process to use npm ci - Fixed JSON serialization error in tools page
1 parent 727e417 commit 61b4931

3 files changed

Lines changed: 49 additions & 11 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,41 @@ permissions:
1515
id-token: 'write'
1616

1717
concurrency:
18-
# Only one execution of this workflow can run at the same time.
19-
group: ${{ github.workflow }}
18+
# Only one execution per branch/PR can run at the same time.
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
2021

2122
jobs:
23+
test:
24+
if: github.event_name == 'pull_request'
25+
runs-on: ubuntu-latest
26+
env:
27+
NEXT_TELEMETRY_DISABLED: 1
28+
CI: true
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 20
36+
cache: 'npm'
37+
38+
- name: Install dependencies
39+
run: npm ci
40+
41+
- name: Run linting
42+
run: npm run lint
43+
44+
- name: Build project
45+
run: npm run build
46+
2247
deploy:
48+
if: github.event_name != 'pull_request'
2349
runs-on: ubuntu-latest
50+
env:
51+
NEXT_TELEMETRY_DISABLED: 1
52+
CI: true
2453
steps:
2554
- uses: actions/checkout@v4
2655

@@ -33,6 +62,21 @@ jobs:
3362
- name: 'Set up Cloud SDK'
3463
uses: 'google-github-actions/setup-gcloud@v2'
3564

65+
- name: Setup Node.js
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: 20
69+
cache: 'npm'
70+
71+
- name: Install dependencies
72+
run: npm ci
73+
74+
- name: Run linting
75+
run: npm run lint
76+
77+
- name: Build project
78+
run: npm run build
79+
3680
- name: 'Configure Docker'
3781
run: gcloud auth configure-docker us-central1-docker.pkg.dev
3882

@@ -70,7 +114,6 @@ jobs:
70114
- name: 'Build Docker Image'
71115
env:
72116
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
73-
NEXT_TELEMETRY_DISABLED: 1
74117
run: |
75118
echo ${{ secrets.FIREBASE_TOKEN }} | base64 -d > ./credentials.json
76119
echo "Building Docker Image with tag $IMAGE_NAME"
@@ -112,11 +155,7 @@ jobs:
112155
stack-name: prod
113156
refresh: true
114157

115-
- uses: actions/setup-node@v4
116-
if: github.ref == 'refs/heads/main'
117-
with:
118-
node-version: 20
119-
cache: 'npm'
158+
# Node.js is already set up earlier in the workflow
120159

121160
- name: 'Update Algolia index'
122161
if: github.ref == 'refs/heads/main'
@@ -125,5 +164,4 @@ jobs:
125164
ALGOLIA_ADMIN_KEY: '${{ secrets.ALGOLIA_ADMIN_KEY }}'
126165
ALGOLIA_INDEX_NAME: 'tools'
127166
run: |
128-
npm install
129167
npm run search-index

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM node:20 as build
22
WORKDIR /src
33

44
COPY package.json package-lock.json /src/
5-
RUN npm install
5+
RUN npm ci
66

77
ENV GOOGLE_APPLICATION_CREDENTIALS=/src/credentials.json
88
ENV FIREBASE_PROJECT_ID=analysis-tools-dev

pages/tools/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { FilterOption } from '@components/tools/listPage/ToolsSidebar/FilterCard
2020
import { getArticlesPreviews } from 'utils-api/blog';
2121

2222
export const getServerSideProps: GetServerSideProps = async (ctx) => {
23-
const sponsors = await getSponsors();
23+
const sponsors = getSponsors();
2424
const articles = await getArticlesPreviews();
2525
const { data: languages = [] } = await fetchLanguages();
2626
const { data: others = [] } = await fetchOthers();

0 commit comments

Comments
 (0)