Skip to content

Commit 6968b12

Browse files
committed
feta: add ci
1 parent 4c71852 commit 6968b12

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [feat/test-ci]
5+
pull_request:
6+
branches: [feat/test-ci]
7+
8+
jobs:
9+
lint:
10+
runs-on: self-hosted
11+
strategy:
12+
matrix:
13+
node-version: [18]
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: pnpm/action-setup@v4
17+
with:
18+
version: 9
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
cache: 'pnpm'
24+
- run: pnpm install --frozen-lockfile
25+
- run: pnpm lint
26+
27+
build:
28+
runs-on: self-hosted
29+
strategy:
30+
matrix:
31+
node-version: [18]
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: pnpm/action-setup@v4
35+
with:
36+
version: 9
37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: 'pnpm'
42+
- run: pnpm install --frozen-lockfile
43+
- run: pnpm build
44+
45+
deploy-dev:
46+
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/dev') }}
47+
runs-on: self-hosted
48+
needs:
49+
- lint
50+
- build
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Install docker
54+
uses: docker/setup-buildx-action@v3
55+
- name: Login to registry
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ${{ secrets.REGISTRY_URL }}
59+
username: ${{ secrets.REGISTRY_USERNAME }}
60+
password: ${{ secrets.REGISTRY_TOKEN }}
61+
- name: Build and push
62+
uses: docker/build-push-action@v6
63+
with:
64+
push: true
65+
build-args: |
66+
NODE_ENV=production
67+
NEXT_PUBLIC_API_URL=https://etu.dev.uttnetgroup.fr/api
68+
NEXT_PUBLIC_API_VERSION=v1
69+
NEXT_PUBLIC_API_REQUEST_TIMEOUT=10000
70+
NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.dev.uttnetgroup.fr/login
71+
tags: |
72+
${{ secrets.REGISTRY_URL }}/etuutt/front:dev
73+
74+
deploy-prod:
75+
if: ${{ github.event_name != 'pull_request' && (github.ref == 'refs/heads/master') }}
76+
runs-on: self-hosted
77+
needs:
78+
- lint
79+
- build
80+
steps:
81+
- uses: actions/checkout@v4
82+
- name: Install docker
83+
uses: docker/setup-buildx-action@v3
84+
- name: Login to registry
85+
uses: docker/login-action@v3
86+
with:
87+
registry: ${{ secrets.REGISTRY_URL }}
88+
username: ${{ secrets.REGISTRY_USERNAME }}
89+
password: ${{ secrets.REGISTRY_TOKEN }}
90+
- name: Build and push
91+
uses: docker/build-push-action@v6
92+
with:
93+
push: true
94+
build-args: |
95+
NODE_ENV=production
96+
NEXT_PUBLIC_API_URL=https://etu.utt.fr/api
97+
NEXT_PUBLIC_API_VERSION=v1
98+
NEXT_PUBLIC_API_REQUEST_TIMEOUT=10000
99+
NEXT_PUBLIC_CAS_SERVICE_URL=https://etu.utt.fr/login
100+
tags: |
101+
${{ secrets.REGISTRY_URL }}/etuutt/front:prod

0 commit comments

Comments
 (0)