-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (73 loc) · 2.3 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
name: Build and Push Images
on:
push:
branches: [ "main" ]
tags:
- v[0-9]+.[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+
pull_request:
branches: [ "main" ]
env:
GO_VERSION: "1.22.5"
jobs:
build-and-push-frontend:
name: Build and Push Frontend Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Build and push frontend image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: projecthami/hami-webui-fe:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }}
golang-lint:
name: Lint Go Code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go environment
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run golint
uses: golangci/golangci-lint-action@v6
with:
version: v1.60
args: "--timeout=5m ./server/..."
build-and-push-backend:
name: Build and Push Backend Image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get branch names.
id: branch-names
uses: tj-actions/branch-names@v8
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_PASSWD }}
- name: Build and push backend image
uses: docker/build-push-action@v6
with:
context: ./server
platforms: linux/amd64,linux/arm64
push: true
tags: projecthami/hami-webui-be:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }}