77 - master
88
99jobs :
10- build- test-deploy :
10+ test-build :
1111 runs-on : ubuntu-latest
12- env :
13- PROJECT_ID : ${{ secrets.GCP_PROJECT_ID }}
14- GAR_LOCATION : ${{ secrets.GAR_LOCATION }} # e.g. us-central1
15- SERVICE : ${{ secrets.CLOUD_RUN_SERVICE }}
16- REGION : ${{ secrets.CLOUD_RUN_REGION }}
17- IMAGE : ${{ secrets.GAR_LOCATION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ secrets.GAR_REPO }}/${{ secrets.CLOUD_RUN_SERVICE }}
18- steps :
19- - name : Checkout code
20- uses : actions/checkout@v4
21-
22- - name : Set up Node.js
23- uses : actions/setup-node@v4
24- with :
25- node-version : ' 20'
26-
27- - name : Install dependencies
28- run : npm ci
29-
30- - name : Run tests
31- run : npm test
3212
33- - name : Set up Google Cloud SDK
34- uses : google-github-actions/auth@v2
35- with :
36- credentials_json : ${{ secrets.GCP_SA_KEY }}
37-
38- - name : Configure Docker for Artifact Registry
39- run : gcloud auth configure-docker $GAR_LOCATION-docker.pkg.dev
40-
41- - name : Build and push Docker image
42- run : |
43- docker build -t $IMAGE:$GITHUB_SHA .
44- docker push $IMAGE:$GITHUB_SHA
45-
46- - name : Deploy to Cloud Run
47- uses : google-github-actions/deploy-cloudrun@v2
48- with :
49- service : ${{ env.SERVICE }}
50- image : ${{ env.IMAGE }}:$GITHUB_SHA
51- region : ${{ env.REGION }}
52- project_id : ${{ env.PROJECT_ID }}
13+ strategy :
14+ matrix :
15+ node-version : [22.x]
16+
17+ steps :
18+ - uses : actions/checkout@v1
19+ - name : Use Node.js ${{ matrix.node-version }}
20+ uses : actions/setup-node@v1
21+ with :
22+ node-version : ${{ matrix.node-version }}
23+
24+ - name : npm install
25+ run : |
26+ npm install
27+ - name : npm test
28+ run : |
29+ npm test
30+
31+ - name : npm test:e2e
32+ run : |
33+ npm run test:e2e
34+
35+ - name : npm build
36+ run : |
37+ npm run build --if-present
0 commit comments