Skip to content

Commit da2daea

Browse files
author
mmahipal
committed
Added Github actions
1 parent d0b6c59 commit da2daea

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Docker
2+
3+
on:
4+
push
5+
6+
env:
7+
# Use docker.io for Docker Hub if empty
8+
REGISTRY: ghcr.io
9+
# github.repository as <account>/<repo>
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Golang setup
18+
uses: actions/setup-go@v1
19+
with:
20+
go-version: 1.16
21+
id: go
22+
23+
- name: Checkout repository
24+
uses: actions/checkout@v2
25+
26+
# Login against a Docker registry except on PR
27+
# https://github.com/docker/login-action
28+
- name: Log into registry ${{ env.REGISTRY }}
29+
if: github.event_name != 'pull_request'
30+
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# Build and push Operator image (don't push on PR)
37+
- name: Build and push Docker image
38+
if: github.event_name != 'pull_request'
39+
run: |
40+
make generate
41+
make manifests
42+
IMAGE=${{ env.IMAGE_NAME }}
43+
IMAGE=${IMAGE,,}
44+
make docker-build IMG="${{ env.REGISTRY }}/${IMAGE}:${GITHUB_REF##*/}"
45+
docker push "${{ env.REGISTRY }}/${IMAGE}:${GITHUB_REF##*/}"
46+
docker rmi "${{ env.REGISTRY }}/${IMAGE}:${GITHUB_REF##*/}" && docker system prune -f
47+
rm -rf bin/

0 commit comments

Comments
 (0)