Skip to content

Commit

Permalink
Added workflow for pull requests. Enabled docker-linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristophShyper committed Dec 3, 2019
1 parent 85ed809 commit f6ea68b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build on pull request

on:
pull_request:
types:
- opened
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1

- name: Docker Lint
uses: luke142367/Docker-Lint-Action@v1.0.0
with:
target: Dockerfile

- name: Build Docker image
if: github.actor != 'Krzysztof-Szyper-Epam'
run: make docker-build
13 changes: 10 additions & 3 deletions .github/workflows/main.yml → .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build and Push to DockerHub
name: Build and push to Docker Hub

on: [push]
on:
push:
branches:
- master

jobs:
build:
Expand All @@ -9,8 +12,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v1

- name: Docker Lint
uses: luke142367/Docker-Lint-Action@v1.0.0
with:
target: Dockerfile

- name: Build and Push Docker image
env:
DOCKER_USER_ID: ${{ secrets.DOCKER_USER_ID }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
run: make build-and-push
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GITHUB_SHA ?= aabbccddeeff
CURRENT_BRANCH := $(shell echo $(GITHUB_REF) | sed 's/refs\/heads\///')
GITHUB_SHORT_SHA := $(shell echo $(GITHUB_SHA) | cut -c1-7)
RELEASE_BRANCH := master
DOCKER_USER_ID := christophshyper
DOCKER_NAME := christophshyper/docker-terragrunt

get-versions:
Expand All @@ -36,9 +37,6 @@ endif
$(info Current branch: $(CURRENT_BRANCH))
$(info Commit hash: $(GITHUB_SHORT_SHA))

docker-login:
@echo $(DOCKER_TOKEN) | docker login -u $(DOCKER_USER_ID) --password-stdin

docker-build: get-versions
@docker rm $(DOCKER_NAME):latest || true
@docker rm $(DOCKER_NAME):$(VERSION) || true
Expand All @@ -50,6 +48,9 @@ docker-build: get-versions
--file=Dockerfile \
--tag=$(DOCKER_NAME):$(VERSION) .

docker-login:
@echo $(DOCKER_TOKEN) | docker login -u $(DOCKER_USER_ID) --password-stdin

docker-push: docker-login
ifeq ($(CURRENT_BRANCH),$(RELEASE_BRANCH))
@docker tag $(DOCKER_NAME):$(VERSION) $(DOCKER_NAME):latest
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Docker image with Terraform/Terragrunt and all needed components to easily manage AWS infrastructure.

[![GitHub krzysztof-szyper-epam/docker-terragrunt](https://img.shields.io/badge/github-krzysztof--szyper--epam%2Fdocker--terragrunt-blue.svg)](https://github.com/krzysztof-szyper-epam/docker-terragrunt "shields.io")
[![Actions Status](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/workflows/Build%20and%20Push%20to%20DockerHub/badge.svg)](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/actions "github.com")
[![Actions Status](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/workflows/Build%20and%20push%20to%20Docker%20Hub/badge.svg)](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/actions?query=workflow%3A%22Build+and+push+to+Docker+Hub%22 "github.com")
[![Actions Status](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/workflows/Build%20on%20pull%20request/badge.svg)](https://github.com/Krzysztof-Szyper-Epam/docker-terragrunt/actions?query=workflow%3A%22Build+on+pull+request%22 "github.com")
![GitHub](https://img.shields.io/github/license/krzysztof-szyper-epam/docker-terragrunt "shields.io")
![GitHub last commit](https://img.shields.io/github/last-commit/krzysztof-szyper-epam/docker-terragrunt "shields.io")
<br>
Expand Down

0 comments on commit f6ea68b

Please sign in to comment.