-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (74 loc) · 1.94 KB
/
cicd.yaml
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
name: CI/CD pipelines
# Send a request to access:
# https://github.com/sir-farfan/litt/
# in order to watch the pipelines
on: [push, workflow_dispatch]
jobs:
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: '^1.15.5'
- name: Check out code
uses: actions/checkout@v2
- name: Run linter for code quality
uses: golangci/golangci-lint-action@v2
with:
version: v1.34.1
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Build app
run: |
go build -o build/main
- name: Save artifact
uses: actions/upload-artifact@v2
with:
name: build
path: build
if-no-files-found: error
retention-days: 1
publish:
name: Publish docker image
needs:
- build
- quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: get artifacts
uses: actions/download-artifact@v2
with:
name: build
path: build
- name: debug
run: ls -lR
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: sulfurf/litt
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
sulfurf/litt:${{ github.sha }}
sulfurf/litt:nightly
sulfurf/litt:latest
labels: |
sulfurf/litt:${{ github.sha }}
sulfurf/litt:nightly
sulfurf/litt:latest