-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (66 loc) · 1.81 KB
/
prod.yaml
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
name: CI/CD Workflow
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mydb
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install dependencies
run: yarn install
- name: Run tests
env:
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/mydb'
run: yarn test
packageChanges:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: run
run: |
yarn install --frozen-lockfile
yarn run lint && yarn run build
publishPackage:
needs: packageChanges
if: needs.packageChanges.result == 'success' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Authenticate with NPM
run: echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> ~/.npmrc
- name: Create Release Pull Request or Publish
id: changesets
run: |
yarn install --frozen-lockfile
yarn run release
env:
GITHUB_TOKEN: ${{ secrets.GGITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}