-
Notifications
You must be signed in to change notification settings - Fork 9
133 lines (108 loc) · 3.45 KB
/
build.yml
File metadata and controls
133 lines (108 loc) · 3.45 KB
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
name: Timeless CI - Build & Publish
on:
push:
branches: [ "main" ]
paths:
- 'timeless-api/**'
- 'whatsapp/**'
- 'infrastructure/**'
pull_request:
branches: [ "main" ]
paths:
- 'timeless-api/**'
- 'whatsapp/**'
- 'infrastructure/**'
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
PUBLISH: ${{ github.repository == 'mcruzdev/timeless' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
jobs:
detect-changes:
uses: ./.github/workflows/detect_changes.yml
timeless-api:
name: Build & Publish - Timeless API (Java)
needs: detect-changes
if: needs.detect-changes.outputs.api == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: timeless-api
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Build API
run: mvn -B -ntp formatter:validate impsort:check package
- name: Setup Node.js 24
uses: actions/setup-node@v4
with:
node-version: "24"
cache: npm
- name: Setup Chrome
id: chrome
uses: browser-actions/setup-chrome@v1
- name: Install Frontend Dependencies
working-directory: ./timeless-api/src/main/webui
run: npm ci
- name: Check code formatting with Prettier
working-directory: ./timeless-api/src/main/webui
run: npm run prettier:check
- name: Set up Podman
uses: gacts/install-podman@v1
if: env.PUBLISH == 'true'
id: podman
- name: Login to Quay.io
if: env.PUBLISH == 'true'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Create Docker image
if: env.PUBLISH == 'true'
run: docker build -f src/main/docker/Dockerfile.jvm -t quay.io/timeless/timeless-api:${GITHUB_SHA::7} .
- name: Push Docker image to Quay.io
if: env.PUBLISH == 'true'
run: docker push quay.io/timeless/timeless-api:${GITHUB_SHA::7}
whatsapp:
name: Build & Publish - WhatsApp Bot (Node.js)
needs: detect-changes
if: needs.detect-changes.outputs.whatsapp == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: whatsapp
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: whatsapp/package-lock.json
- name: Install dependencies
run: npm ci
- name: Check code formatting with Prettier
run: npm run prettier:check
- name: Login to Quay.io
if: env.PUBLISH == 'true'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Create Docker image
if: env.PUBLISH == 'true'
run: docker build -f Dockerfile -t quay.io/timeless/whatsapp:${GITHUB_SHA::7} .
- name: Push Docker image to Quay.io
if: env.PUBLISH == 'true'
run: docker push quay.io/timeless/whatsapp:${GITHUB_SHA::7}