Skip to content

Commit

Permalink
Add GitHub flow (#78)
Browse files Browse the repository at this point in the history
* added github flo
  • Loading branch information
mr-exz authored Nov 6, 2021
1 parent a558e65 commit 7dc49be
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Docker Image CI
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push docker image
run: make all
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## 0.6.8
### Improvements
- Added github flow
- Added Makefile to build project and tag it
- Added versioning from CHANGELOG.md

## 0.6.7
### Improvements
- Added actions table, bot will suggest "actions" on certain "problems"
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM ruby:2.7.3
ARG DOCKER_IMAGE_TAG

ENV DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG

RUN apt-get update -qq && apt-get install -y nodejs cron \
&& apt-get clean autoclean \
Expand Down
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
DOCKER_IMAGE_NAME = whoisondutytoday
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

ifeq ("$(BRANCH)", "master")
DOCKER_IMAGE_TAG = $(shell cat ./CHANGELOG.md | grep -e '^\#\# .*' | head -n 1 | cut -d' ' -f 2)
else
DOCKER_IMAGE_TAG = $(shell cat ./CHANGELOG.md | grep -e '^\#\# .*' | head -n 1 | cut -d' ' -f 2)-${BRANCH}
endif

DOCKER_REGISTRY_URL = docker.io/mrexz

build:
docker build --build-arg DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG} -t ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} .

tag-latest:
ifeq ("$(BRANCH)", "master")
docker tag ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:latest
endif

tag-latest-force:
docker tag ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG} ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:latest


push:
docker push ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}
ifeq ("$(BRANCH)", "master")
docker push ${DOCKER_REGISTRY_URL}/${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_TAG}:latest
endif

all: build tag-latest push
2 changes: 1 addition & 1 deletion config/initializers/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Whoisondutytoday
class Application
VERSION = "0.6.7"
VERSION = ENV['DOCKER_IMAGE_TAG']
end
end
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
whoisondutytoday:
image: whoisondutytoday
image: mrexz/whoisondutytoday:latest
restart: always
container_name: whoisondutytoday
build: .
Expand Down

0 comments on commit 7dc49be

Please sign in to comment.