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