-
Notifications
You must be signed in to change notification settings - Fork 636
71 lines (63 loc) · 2.11 KB
/
Copy pathdocker.yml
File metadata and controls
71 lines (63 loc) · 2.11 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Docker
on:
push:
pull_request:
workflow_dispatch:
env:
DOCKERHUB_IMAGE: kivy/buildozer
GHCR_IMAGE: ghcr.io/kivy/buildozer
SHOULD_PUBLISH: ${{ github.repository_owner == 'kivy' && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) }}
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 60
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
# Login to DockerHub
- uses: docker/login-action@v4
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Login to GHCR
- uses: docker/login-action@v4
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Multi-platform Image
uses: docker/build-push-action@v7
with:
push: ${{ env.SHOULD_PUBLISH == 'true' }}
tags: |
${{ env.DOCKERHUB_IMAGE }}:latest
${{ env.GHCR_IMAGE }}:latest
platforms: linux/amd64,linux/arm64
- name: Local Build for Testing
uses: docker/build-push-action@v7
with:
# Load image into local Docker daemon
load: true
tags: ${{ env.DOCKERHUB_IMAGE }}:latest
# Run the locally built image to test it
- name: Docker run
run: |
docker run ${{ env.DOCKERHUB_IMAGE }} --version
docker run --rm --volume "$PWD":/home/user/hostcwd ${{ env.DOCKERHUB_IMAGE }} init
update-readme:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v6
- uses: peter-evans/dockerhub-description@v5
if: ${{ env.SHOULD_PUBLISH == 'true' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DOCKERHUB_IMAGE }}
readme-filepath: README.md