-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (143 loc) · 4.94 KB
/
main.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
148
149
150
151
152
153
154
155
156
name: CI
on:
push:
workflow_dispatch:
jobs:
lint-backend:
runs-on: ubuntu-latest
container: node:22.3.0-alpine3.19
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Install dependencies and lint javascript
run: |
corepack enable
corepack prepare pnpm@9.4.0 --activate
cd backend
pnpm install --frozen-lockfile
pnpm lint
lint-frontend:
runs-on: ubuntu-latest
container: node:22.3.0-alpine3.19
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Install dependencies and lint javascript
run: |
corepack enable
corepack prepare pnpm@9.4.0 --activate
cd frontend
pnpm install --frozen-lockfile
pnpm lint
test-backend:
needs: [lint-backend]
runs-on: ubuntu-latest
container: node:22.3.0-alpine3.19
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Install dependencies and test backend
run: |
corepack enable
corepack prepare pnpm@9.4.0 --activate
cd backend
pnpm install --frozen-lockfile
pnpm test
test-build-docker-image:
needs: [lint-backend, lint-frontend, test-backend]
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.4.0
- name: Login to DockerHub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6.3.0
with:
tags: gibbonlab/gibbon-mail:test-build-ci
file: docker-image/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
pre-release:
name: "Pre Release"
needs: [lint-backend, lint-frontend, test-backend, test-build-docker-image]
if: ${{ github.repository == 'gibbon-lab/gibbon-mail' && contains(github.ref, 'refs/heads/master') }}
runs-on: "ubuntu-latest"
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.4.0
- name: Login to DockerHub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6.3.0
with:
push: true
tags: gibbonlab/gibbon-mail:latest
file: docker-image/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build"
tagged-release:
name: "Tagged Release"
needs: [lint-backend, lint-frontend, test-backend, test-build-docker-image]
if: ${{ github.repository == 'gibbon-lab/gibbon-mail' && contains(github.ref, 'refs/tags/v') }}
runs-on: "ubuntu-latest"
steps:
- name: Checkout project
uses: actions/checkout@v4.1.7
- name: Generate version variable
id: branch_name
run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.1.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.4.0
- name: Login to DockerHub
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.GIBBON_LAB_DOCKER_REGISTRY_PASSWORD }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6.3.0
with:
push: true
tags: gibbonlab/gibbon-mail:${{ steps.branch_name.outputs.TAG_VERSION }}
file: docker-image/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
- uses: actions/setup-node@v4.0.2
with:
node-version: '22.3.0'
registry-url: 'https://registry.npmjs.org'
- uses: pnpm/action-setup@v4
with:
version: 9.4.0
- run: scripts/deploy-to-npm.sh
env:
NODE_AUTH_TOKEN: ${{ secrets.GIBBON_LAB_NPM_TOKEN }}
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false