-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (50 loc) · 1.52 KB
/
docker-publish.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
name: Docker-Publish
on:
push:
# Publish `release` as Docker `latest` image.
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
# TODO: Change variable to your image's name.
IMAGE_NAME: kotlang-auth
IMAGE_TAG: ${{ github.sha }}
jobs:
build-service:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
- name: Install protoc
run: sudo apt install -y protobuf-compiler
- name: Install go-grpc
run: |
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go install google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
echo "${HOME}/go/bin" >> $GITHUB_PATH
echo "Path is ${GITHUB_PATH}"
- name: Build
run: ./build.sh
- name: Build docker image
run: docker build -t navachar/$IMAGE_NAME:$IMAGE_TAG .
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image
run: |
if [ "${{ github.ref }}" == "refs/heads/master" ]; then
docker push navachar/$IMAGE_NAME:$IMAGE_TAG
fi