-
Notifications
You must be signed in to change notification settings - Fork 1
117 lines (96 loc) · 3.17 KB
/
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
108
109
110
111
112
113
114
115
116
117
name: API
on:
workflow_dispatch:
pull_request:
paths:
- package.json
- api/**
branches:
- main
push:
paths:
- api/**
branches:
- main
jobs:
test:
if: github.event_name != 'push'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: npm auth
run: |
npm config set @kashw2:registry https://npm.pkg.github.com/
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}
npm config set registry https://registry.npmjs.org/
- name: install globals
run: npm install -g lerna
- name: npm install
run: npm ci --force
- name: build libraries
run: npm run build -w @kashw2/lib-util -w @kashw2/lib-external -w @kashw2/lib-ts -w @kashw2/lib-server
- name: test api
run: lerna run test --scope=@ffk/api
build:
if: github.event_name != 'push'
needs: [test]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: npm auth
run: |
npm config set @kashw2:registry https://npm.pkg.github.com/
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}
npm config set registry https://registry.npmjs.org/
- name: install globals
run: npm install -g lerna
- name: npm install
run: npm ci --force
- name: build libraries
run: npm run build -w @kashw2/lib-util -w @kashw2/lib-external -w @kashw2/lib-ts -w @kashw2/lib-server
- name: build api
run: lerna run build:dev --scope=@ffk/api
deploy:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: npm auth
run: |
npm config set @kashw2:registry https://npm.pkg.github.com/
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GH_TOKEN }}
npm config set registry https://registry.npmjs.org/
- name: install globals
run: npm install -g lerna
- name: npm install
run: npm ci --force
- name: build libraries
run: npm run build -w @kashw2/lib-util -w @kashw2/lib-external -w @kashw2/lib-ts -w @kashw2/lib-server
- name: build api
run: lerna run build:dev --scope=@ffk/api
- name: deploy
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- run: |
docker build -t ghcr.io/kashw2/api.faithfulknights.com:${{ github.sha }} -t ghcr.io/kashw2/api.faithfulknights.com:latest -f Dockerfile .
docker push ghcr.io/kashw2/api.faithfulknights.com:${{ github.sha }}
docker push ghcr.io/kashw2/api.faithfulknights.com:latest
working-directory: api