Skip to content

Commit

Permalink
Extracts Dockerhub login to Github action
Browse files Browse the repository at this point in the history
  • Loading branch information
messeb committed Mar 20, 2023
1 parent 92b2d43 commit 49ff438
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make build
5 changes: 5 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make release
5 changes: 5 additions & 0 deletions .github/workflows/staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: make build
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
DOCKER_USER := $(DOCKER_USER)
DOCKER_PASS := $(DOCKER_PASS)
IMAGE_TAG := $(IMAGE_TAG)
IMAGE := mobiledevops/android-sdk-image

release: \
tag_image \
dockerhub_login \
dockerhub_push \

tag_image: build
Expand All @@ -14,11 +11,8 @@ tag_image: build
build:
docker build -t $(IMAGE) .

dockerhub_login:
echo $(DOCKER_PASS) | docker login -u $(DOCKER_USER) --password-stdin

dockerhub_push:
docker push $(IMAGE):latest \
&& docker push "$(IMAGE):$(IMAGE_TAG)"

.PHONY: release tag_image build dockerhub_login dockerhub_push
.PHONY: release tag_image build dockerhub_push

0 comments on commit 49ff438

Please sign in to comment.