From ec10d20b4bae243a8d05a8c744f4296a92f1861d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Christian=20Langfj=C3=A6ran?= Date: Mon, 29 Apr 2019 13:31:05 +0200 Subject: [PATCH 1/5] Use github actions to publish to docker hub --- .github/main.workflow | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/main.workflow b/.github/main.workflow index f529e02..dee6d51 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -1,6 +1,6 @@ workflow "Build" { on = "push" - resolves = "Docker build" + resolves = "Publish" } action "Lint" { @@ -21,3 +21,22 @@ action "Docker build" { runs = "make" args = "build" } + +action "Publish Filter" { + needs = ["Test"] + uses = "actions/bin/filter@master" + args = "branch docker-publish" +} + +action "Docker Login" { + needs = ["Publish Filter", "Docker build"] + uses = "actions/docker/login@master" + secrets = ["DOCKER_USERNAME", "DOCKER_PASSWORD"] +} + +action "Publish" { + needs = ["Docker Login"] + uses = "actions/action-builder/docker@master" + runs = "make" + args = "publish" +} From 41c3e2cfcdb107416955d86219ca02a1c54d9b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Christian=20Langfj=C3=A6ran?= Date: Mon, 29 Apr 2019 13:38:36 +0200 Subject: [PATCH 2/5] Add publish as a make goal --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 6d5944f..2c262bd 100644 --- a/Makefile +++ b/Makefile @@ -22,4 +22,8 @@ test: ## Call the 'test' target on all sub-modules .PHONY: dev-all dev-all: lint build test +.PHONY: publish +publish: ## Call the 'publish' target on all sub-modules + $(foreach mod,$(MODULES),($(MAKE) -C $(mod) $@) || exit $$?;) + include help.mk \ No newline at end of file From b6467d85455be972d4dea9f43d8b444caaf588ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Christian=20Langfj=C3=A6ran?= Date: Mon, 29 Apr 2019 13:55:41 +0200 Subject: [PATCH 3/5] Add dockerhub to README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 59d95b1..075773d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # actions Various Github Actions + +# Dockerhub +Images are deployed to https://cloud.docker.com/u/unacast/repository/ From 865fcbcec0dfa8ae6e4b1c76243cf1cf9fa42cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Christian=20Langfj=C3=A6ran?= Date: Mon, 29 Apr 2019 13:58:07 +0200 Subject: [PATCH 4/5] Only deploy to dockerhub for masterbranch --- .github/main.workflow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/main.workflow b/.github/main.workflow index dee6d51..084d286 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -25,7 +25,7 @@ action "Docker build" { action "Publish Filter" { needs = ["Test"] uses = "actions/bin/filter@master" - args = "branch docker-publish" + args = "branch master" } action "Docker Login" { From b474e0f9687453ecb8211c8d60389671ff387df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Christian=20Langfj=C3=A6ran?= Date: Mon, 29 Apr 2019 14:03:49 +0200 Subject: [PATCH 5/5] Move publish filter after build --- .github/main.workflow | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/main.workflow b/.github/main.workflow index 084d286..9f16570 100644 --- a/.github/main.workflow +++ b/.github/main.workflow @@ -23,13 +23,13 @@ action "Docker build" { } action "Publish Filter" { - needs = ["Test"] + needs = ["Docker build"] uses = "actions/bin/filter@master" args = "branch master" } action "Docker Login" { - needs = ["Publish Filter", "Docker build"] + needs = ["Publish Filter"] uses = "actions/docker/login@master" secrets = ["DOCKER_USERNAME", "DOCKER_PASSWORD"] }