-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (91 loc) · 2.85 KB
/
wip-deploy-ci-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: (WIP) CI - API - Build and deploy
on:
push:
paths:
- "api/**"
- "packages/**"
- ".github/workflows/wip-deploy-ci-api.yml" # TODO: remove
branches: # TODO: remove me
- 3577-app
env:
ENVIRONMENT: ci
APP_NAME: api
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
- uses: actions/cache@v4
id: cache-npm
with:
path: |
node_modules
api/node_modules
packages/ds/node_modules
packages/lib/node_modules
key: ${{ runner.os }}-nodemodules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-nodemodules-
- name: Install packages
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Build lib
working-directory: packages/lib
run: npm run build
# Typescript check
- name: Check types
working-directory: api
run: npm run check-types
# ESLint check
# - name: Lint code
# working-directory: api
# run: npm run lint
- name: Start MongoDB 7.0
uses: supercharge/[email protected]
with:
mongodb-version: "7.0"
- name: Test and Send coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CI: true
with:
workingDirectory: api
coverageCommand: npm run coverage
deploy:
needs: [test]
runs-on: ubuntu-latest
outputs:
release: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "18.20"
- name: Get release name
id: release
working-directory: devops/scripts
run: |
release=$(node get-image-tag.js ${{ github.event.after }})
echo "release: $release"
echo "release=$release" >> $GITHUB_OUTPUT
- name: Docker Build & Publish
working-directory: devops/scripts
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
VITE_RELEASE: ${{ steps.release.outputs.release }}
run: |
node ./build-application-docker.js $ENVIRONMENT $APP_NAME --push
# - name: Deploy on Scaleway
# working-directory: devops/scripts
# env:
# SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
# SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
# run: |
# node ./deploy-scaleway.js $ENVIRONMENT $APP_NAME ${{ steps.release.outputs.release }}