-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (68 loc) · 2.05 KB
/
travel-api.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
name: 'travel ci'
on:
push:
pull_request:
types: [ opened, reopened ]
jobs:
unit-test:
strategy:
matrix:
go-version: [1.18.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: setup GOPATH into PATH
run: |
echo "::set-env name=GOPATH::$(go env GOPATH)"
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
- uses: actions/checkout@v2
- name: Run's Golint
working-directory: travel
run: |
export PATH=$PATH:$(go env GOPATH)/bin
go get -u golang.org/x/lint/golint
# golint -set_exit_status ./...
- name: Install dependencies
working-directory: travel
run: go get -u
- name: Test
working-directory: travel
run: go test -v
build-docker-artifacts:
needs: [ unit-test ]
runs-on: ubuntu-latest
if: contains(github.ref, 'main')
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.18.x'
- uses: actions/checkout@v1
- name: Docker Build
working-directory: travel
run: docker build -t travel:latest .
- name: Docker Tag Latest
working-directory: travel
run: docker tag travel:latest jonathan99/travel:latest
- name: Docker Tag Release
run: |
TAG=$(git rev-parse --short HEAD)
docker tag travel:latest jonathan99/travel:$TAG
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Docker Push Latest
working-directory: travel
run: docker push jonathan99/travel:latest
- name: Docker Push Release Tag
working-directory: travel
run: |
TAG=$(git rev-parse --short HEAD)
docker push jonathan99/travel:$TAG