Skip to content

Commit

Permalink
Merge pull request #13 from kanishkarj/master
Browse files Browse the repository at this point in the history
CI for learn-layer5
  • Loading branch information
leecalcote authored Jun 22, 2020
2 parents 24cf2d8 + 0fc3ef9 commit c110733
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Learn Layer5

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
docker:
name: Docker build and push
runs-on: ubuntu-latest
steps:
- name: Check out code
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success()
uses: actions/checkout@master
with:
fetch-depth: 1
- name: Docker login
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success()
uses: azure/docker-login@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker build & push
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && success()
run: |
make build-img-service
make image-push
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VER=$(shell git rev-parse --short HEAD)

build-service:
cd service && go build -a -o ./main .

Expand All @@ -12,4 +14,7 @@ run-service-b:
./service/main

build-img-service:
cd service && docker build -t layer5/sample-app-service:dev .
cd service && docker build -t layer5/learn-layer5:latest -t layer5/learn-layer5:$(VER) .

image-push:
docker push layer5/learn-layer5

0 comments on commit c110733

Please sign in to comment.