-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (33 loc) · 1.07 KB
/
build.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
name: Build
on: [push, pull_request]
jobs:
build-and-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.16.0'
- name: Install Go module dependencies
run: |
go version
go mod download
- name: Build the binary natively
run: go build -v cmd/hoard.go
- name: Run the tests natively
run: go test -v ./...
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: jamespfennell
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image and push to Docker Hub
id: docker_build
uses: docker/build-push-action@v2
with:
tags: jamespfennell/hoard:latest
# Only push to Docker Hub if this workflow is a push to master
push: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' }}