-
Notifications
You must be signed in to change notification settings - Fork 1
147 lines (125 loc) · 3.96 KB
/
ci.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Continuous Integration
on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled]
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout message-pickup-repository
uses: actions/checkout@v4
- name: Setup node v22
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: |
yarn install
- name: Check Format
run: |
yarn format
- name: Check Types
run: |
yarn check-types
- name: Unit tests
run: |
yarn test
- name: E2E tests
run: |
yarn test:e2e
release-please:
runs-on: ubuntu-latest
needs: [build]
outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
paths_released: ${{ steps.release-please.outputs.paths_released }}
steps:
- uses: googleapis/release-please-action@v4
id: release-please
with:
path: ./packages
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
token: ${{ secrets.GITHUB_TOKEN }}
- name: Print release outputs for debugging
continue-on-error: true
run: |
echo "Release outputs:"
echo ${{ toJson(steps.release-please.outputs) }}
# Initiate release process if release was created
release-client:
if: contains(needs.release-please.outputs.paths_released, 'packages/client')
runs-on: ubuntu-latest
needs: [release-please]
steps:
- name: Checkout message-pickup-repository
uses: actions/checkout@v4
- name: Setup node v20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Release to NPM
run: |
cd packages/client
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release-server:
if: contains(needs.release-please.outputs.paths_released, 'packages/server')
runs-on: ubuntu-latest
needs: [release-please]
env:
DH_USERNAME: ${{secrets.DOCKER_HUB_LOGIN}}
DH_TOKEN: ${{secrets.DOCKER_HUB_PWD}}
IMAGE_NAME: 'message-pickup-repository'
IMAGE_TAG: ${{ github.ref == 'refs/heads/main' && 'dev' || github.ref }}
steps:
- name: Checkout message-pickup-repository
uses: actions/checkout@v4
- name: Setup node v20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Log in to Docker Hub
run: |
echo "$DH_TOKEN" | docker login -u "$DH_USERNAME" --password-stdin
- name: Build Docker image
run: |
cp yarn.lock packages/server
cd packages/server
docker build -f Dockerfile -t $DH_USERNAME/$IMAGE_NAME:$IMAGE_TAG .
- name: Push to DockerHub
run: docker push $DH_USERNAME/$IMAGE_NAME:$IMAGE_TAG
release-postgres:
if: contains(needs.release-please.outputs.paths_released, 'packages/postgres')
runs-on: ubuntu-latest
needs: [release-please]
steps:
- name: Checkout message-pickup-repository
uses: actions/checkout@v4
- name: Setup node v20
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org/'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-scripts
- name: Release to NPM
run: |
cd packages/postgres
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}