Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Docker workflow fixes #3067

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
push:
branches:
- develop
tags:
- "*"
pull_request:

jobs:
Expand All @@ -14,11 +16,18 @@ jobs:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- run: make docker/build
- name: docker login
if: github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/')
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: make docker/login
- name: docker push
if: github.ref == 'develop'
if: github.ref == 'refs/heads/develop'
run: make docker/push
run: echo make docker/push
- name: docker push (tag)
if: startsWith(github.ref, 'refs/tags/')
run: |
make docker/login
make docker/tag DOCKER_TAG=${GITHUB_REF#refs/tags/}
make docker/push
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ TOX=`which tox`
ACTIVATE=$(VIRTUAL_ENV)/bin/activate
PYTHON=$(VIRTUAL_ENV)/bin/python
DOCKER_IMAGE=kivy/python-for-android
DOCKER_TAG=latest
ANDROID_SDK_HOME ?= $(HOME)/.android/android-sdk
ANDROID_NDK_HOME ?= $(HOME)/.android/android-ndk
ANDROID_NDK_HOME_LEGACY ?= $(HOME)/.android/android-ndk-legacy
Expand Down Expand Up @@ -118,10 +119,13 @@ docker/build:
docker build --cache-from=$(DOCKER_IMAGE) --tag=$(DOCKER_IMAGE) .

docker/login:
@echo $(DOCKERHUB_TOKEN) | docker login --username $(DOCKERHUB_USERNAME) --password-stdin
@echo $$DOCKERHUB_TOKEN | docker login --username $(DOCKERHUB_USERNAME) --password-stdin

docker/tag:
docker tag $(DOCKER_IMAGE):latest $(DOCKER_IMAGE):$(DOCKER_TAG)

docker/push:
docker push $(DOCKER_IMAGE)
docker push $(DOCKER_IMAGE):$(DOCKER_TAG)

docker/run/test: docker/build
docker run --rm --env-file=.env $(DOCKER_IMAGE) 'make test'
Expand Down
Loading