-
Notifications
You must be signed in to change notification settings - Fork 0
127 lines (97 loc) · 2.9 KB
/
master.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
name: Main branch workflow
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
env:
DOCKER_HUB_REPO: "docker.io/slashdevops"
DOCKER_BUILD_ARCHS: "amd64"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install promu
run: make promu
- name: Build and Test Linux Platform Only
run: make
- name: Check code modifications
run: git diff --exit-code
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install promu
run: make promu
- name: Build Cross-Platform
run: promu crossbuild -v
- name: List Workspace Files
run: ls -la .
- name: List .build Files
run: ls -la .build
- name: Upload .build artifacts
uses: actions/upload-artifact@v2
with:
name: .build
path: .build
publish_docker_images:
name: Publish Docker Images
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v4
with:
go-version: ^1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install promu
run: make promu
- name: Docker Version
run: docker version
- name: Download .build artifacts from Build Step
uses: actions/download-artifact@v2
with:
name: .build
path: .build
- name: Assign Execution Permission to Binaries
run: chmod -R +x .build/*/*
- name: List Workspace Files
run: ls -la .
- name: List .build Files
run: ls -la .build
- name: Build Docker Images
run: make docker DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Docker Tag Images Latest
run: make docker-tag-latest DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Show Local Docker Images
run: docker images
- name: Loging in Docker Hub
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
- name: Publish Images in Docker Hub
run: make docker-publish DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Publish Manifest in Docker Hub
run: make docker-manifest DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS