|
4 | 4 | pull_request: |
5 | 5 | branches: |
6 | 6 | - master |
| 7 | + - gcc-15 |
7 | 8 | push: |
8 | 9 | branches: |
9 | 10 | - master |
| 11 | + - gcc-15 |
| 12 | + tags: |
| 13 | + - "v*" # Construir también cuando se sube un tag v1.0, etc. |
10 | 14 | schedule: |
11 | 15 | - cron: "0 0 * * *" |
12 | 16 | repository_dispatch: |
13 | 17 | types: [run_build] |
14 | 18 |
|
| 19 | +env: |
| 20 | + REGISTRY_IMAGE: vitasdk/buildscripts |
| 21 | + |
15 | 22 | jobs: |
16 | 23 | build: |
17 | 24 | runs-on: ubuntu-latest |
18 | | - |
19 | 25 | steps: |
20 | | - - uses: actions/checkout@v3 |
21 | | - |
22 | | - - name: Set up QEMU |
23 | | - uses: docker/setup-qemu-action@v2 |
24 | | - |
25 | | - - name: Set up Docker Buildx |
26 | | - uses: docker/setup-buildx-action@v2 |
27 | | - |
28 | | - - name: Login to DockerHub |
29 | | - uses: docker/login-action@v2 |
30 | | - with: |
31 | | - username: ${{ secrets.DOCKER_USERNAME }} |
32 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
33 | | - if: github.event_name != 'pull_request' |
34 | | - |
35 | | - - uses: docker/build-push-action@v3 |
36 | | - with: |
37 | | - push: ${{ github.event_name != 'pull_request' }} |
38 | | - tags: vitasdk/buildscripts:latest |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + # Genera tags y labels automáticamente |
| 29 | + # master -> vitasdk/buildscripts:master, vitasdk/buildscripts:latest |
| 30 | + # PR #5 -> vitasdk/buildscripts:pr-5 |
| 31 | + # Tag v1.0 -> vitasdk/buildscripts:1.0, vitasdk/buildscripts:latest |
| 32 | + - name: Docker meta |
| 33 | + id: meta |
| 34 | + uses: docker/metadata-action@v5 |
| 35 | + with: |
| 36 | + images: ${{ env.REGISTRY_IMAGE }} |
| 37 | + tags: | |
| 38 | + type=ref,event=branch |
| 39 | + type=ref,event=pr |
| 40 | + type=semver,pattern={{version}} |
| 41 | + type=semver,pattern={{major}}.{{minor}} |
| 42 | + type=raw,value=latest,enable={{is_default_branch}} |
| 43 | +
|
| 44 | + - name: Set up QEMU |
| 45 | + uses: docker/setup-qemu-action@v3 |
| 46 | + |
| 47 | + - name: Set up Docker Buildx |
| 48 | + uses: docker/setup-buildx-action@v3 |
| 49 | + |
| 50 | + - name: Login to DockerHub |
| 51 | + if: github.event_name != 'pull_request' |
| 52 | + uses: docker/login-action@v3 |
| 53 | + with: |
| 54 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 55 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 56 | + |
| 57 | + - name: Build and push |
| 58 | + uses: docker/build-push-action@v5 |
| 59 | + with: |
| 60 | + context: . |
| 61 | + push: ${{ github.event_name != 'pull_request' }} |
| 62 | + tags: ${{ steps.meta.outputs.tags }} |
| 63 | + labels: ${{ steps.meta.outputs.labels }} |
| 64 | + # Construir para amd64 (estándar) y arm64 (Apple Silicon, RPi) |
| 65 | + platforms: linux/amd64,linux/arm64 |
| 66 | + # Habilitar caché de GitHub Actions |
| 67 | + cache-from: type=gha |
| 68 | + cache-to: type=gha,mode=max |
0 commit comments