-
Notifications
You must be signed in to change notification settings - Fork 508
54 lines (50 loc) · 1.8 KB
/
docker.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Docker
on:
push:
pull_request:
workflow_dispatch:
env:
IMAGE_NAME: kivy/buildozer
SHOULD_PUBLISH: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push Multi-platform Image
uses: docker/build-push-action@v6
with:
push: ${{ env.SHOULD_PUBLISH == 'true' }}
tags: ${{ env.IMAGE_NAME }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
cache-to: ${{ env.SHOULD_PUBLISH == 'true' && format('type=registry,ref={0}:latest,mode=max', env.IMAGE_NAME) || '' }}
- name: Local Build for Testing
uses: docker/build-push-action@v6
with:
# Load image into local Docker daemon
load: true
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest
tags: ${{ env.IMAGE_NAME }}:latest
# Run the locally built image to test it
- name: Docker run
run: docker run ${{ env.IMAGE_NAME }} --version
update-readme:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: peter-evans/dockerhub-description@v4
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
readme-filepath: README.md