1- on :
2- workflow_dispatch :
3-
1+ name : Build and Push Docker Image
42
5- env :
6- REGISTRY : ghcr.io
7- IMAGE_NAME : bevy-mod-scripting
3+ on :
4+ workflow_dispatch : # Allow manual triggering
85
96jobs :
10- build-runner-image :
7+ docker :
8+ runs-on : ubuntu-latest
119 permissions :
1210 contents : read
1311 packages : write
14- runs-on : ubuntu-latest
15- name : Build multi-platform Docker image
16- outputs :
17- image : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}
12+
1813 steps :
19- - uses : actions/checkout@v4
20- - uses : docker/setup-qemu-action@v3
21- - uses : docker/setup-buildx-action@v3
22- - name : Docker meta
23- id : meta
24- uses : docker/metadata-action@v5
14+ - name : Checkout repository
15+ uses : actions/checkout@v4
16+ with :
17+ submodules : ' recursive'
18+
19+ - name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v3
21+
22+ - name : Set up QEMU
23+ uses : docker/setup-qemu-action@v3
2524 with :
26- images : |
27- ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
28- - name : Login to GitHub Container Registry
25+ platforms : ' arm64,amd64'
26+
27+ - name : Login to DockerHub
28+ if : github.event_name != 'pull_request'
2929 uses : docker/login-action@v3
3030 with :
31- registry : ghcr.io
32- username : ${{ github.actor }}
33- password : ${{ secrets.GITHUB_TOKEN }}
34- - uses : docker/build-push-action@v5
31+ username : ${{ secrets.DOCKERHUB_USER }}
32+ password : ${{ secrets.DOCKERHUB_TOKEN }}
33+
34+ - name : Extract metadata for Docker
35+ id : meta
36+ uses : docker/metadata-action@v5
37+ with :
38+ images : makspll/bevy_mod_scripting
39+ flavor : |
40+ prefix=xtask-
41+ tags : |
42+ type=ref,event=branch
43+ type=ref,event=pr
44+ type=semver,pattern={{version}}
45+ type=semver,pattern={{major}}.{{minor}}
46+ type=sha,format=short
47+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
48+
49+ - name : Build and push Docker image
50+ uses : docker/build-push-action@v5
3551 with :
3652 context : .
37- file : ./crates/xtask/ Dockerfile
53+ file : ./Dockerfile
3854 platforms : linux/amd64,linux/arm64
39- cache-from : type=gha
40- cache-to : type=gha,mode=max
55+ push : true
4156 tags : ${{ steps.meta.outputs.tags }}
4257 labels : ${{ steps.meta.outputs.labels }}
58+ cache-from : type=gha
59+ cache-to : type=gha,mode=max
0 commit comments