-
Notifications
You must be signed in to change notification settings - Fork 46
45 lines (41 loc) · 1.16 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
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: CI
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Test
run: make test
- name: Build
run: make build
build-image:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/master'
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions/checkout@v3
-
name: Build the Docker image
run: |
make build
make image
if [[ ${{ github.ref_name }} == "master" ]]; then make push-image; fi
if [[ ${{ github.ref_name }} == "develop" ]]; then make push-develop; fi
if [[ ${{ github.ref_type }} == "tag" ]]; then make push-tag; fi