|
1 | | -name: Build and push Docker image |
| 1 | +name: Build (no Docker required) |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ main ] |
6 | | - paths: |
7 | | - - 'docker/**' |
| 5 | + branches: [ main, master, guardian-beacon ] |
8 | 6 | pull_request: |
9 | | - branches: [ main ] |
10 | | - paths: |
11 | | - - 'docker/**' |
12 | | - # Allows you to run this workflow manually from the Actions tab |
13 | | - workflow_dispatch: |
14 | 7 |
|
15 | 8 | jobs: |
16 | 9 | build: |
17 | | - runs-on: ubuntu-22.04 |
18 | | - env: |
19 | | - USERNAME: infinitime |
20 | | - steps: |
21 | | - - uses: actions/checkout@v3 |
| 10 | + runs-on: ubuntu-latest |
22 | 11 |
|
23 | | - - name: Log in to Docker Hub |
24 | | - if: github.event_name != 'pull_request' |
25 | | - uses: docker/login-action@v2 |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@v4 |
26 | 15 | with: |
27 | | - username: ${{ secrets.DOCKER_HUB_LOGIN_USERNAME }} |
28 | | - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
| 16 | + submodules: recursive # jeśli masz submoduły, to je pobierze |
29 | 17 |
|
30 | | - - name: Set up Docker metadata |
31 | | - id: meta |
32 | | - uses: docker/metadata-action@v4 |
| 18 | + # --- [OPCJONALNE] Logowanie do Docker Hub – odpali się tylko gdy są sekrety --- |
| 19 | + - name: Log in to Docker Hub (optional) |
| 20 | + if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} |
| 21 | + uses: docker/login-action@v3 |
33 | 22 | with: |
34 | | - images: | |
35 | | - ${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build |
36 | | - tags: | |
37 | | - type=sha |
38 | | - type=raw,value=latest |
39 | | -
|
40 | | - - name: Set up QEMU |
41 | | - uses: docker/setup-qemu-action@v2 |
42 | | - |
43 | | - - name: Set up Docker Buildx |
44 | | - id: buildx |
45 | | - uses: docker/setup-buildx-action@v2 |
46 | | - |
47 | | - - name: Build and push |
48 | | - if: github.event_name != 'pull_request' |
49 | | - uses: docker/build-push-action@v3 |
| 23 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 24 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 25 | + |
| 26 | + # Tu daj swoje kroki budowania (jeśli jeszcze nie mamy SDK, to na razie pomijamy) |
| 27 | + - name: Print repo tree (diagnostic) |
| 28 | + run: | |
| 29 | + echo "Repo content:" |
| 30 | + ls -la |
| 31 | + echo |
| 32 | + echo "If you want to build firmware, we will add SDK step later." |
| 33 | +
|
| 34 | + # --- [OPCJONALNE] Build and push Docker image – też odpali się tylko z sekretami --- |
| 35 | + - name: Build & Push Docker image (optional) |
| 36 | + if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} |
| 37 | + uses: docker/build-push-action@v6 |
50 | 38 | with: |
51 | | - context: ./docker/ |
52 | | - file: ./docker/Dockerfile |
53 | | - platforms: linux/amd64,linux/arm64 |
54 | | - builder: ${{ steps.buildx.outputs.name }} |
| 39 | + context: . |
55 | 40 | push: true |
56 | | - tags: ${{ steps.meta.outputs.tags }} |
57 | | - labels: ${{ steps.meta.outputs.labels }} |
58 | | - cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache |
59 | | - cache-to: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache,mode=max |
60 | | - |
61 | | - - name: Build |
62 | | - if: github.event_name == 'pull_request' |
63 | | - uses: docker/build-push-action@v3 |
64 | | - with: |
65 | | - context: ./docker/ |
66 | | - file: ./docker/Dockerfile |
67 | | - platforms: linux/amd64,linux/arm64 |
68 | | - builder: ${{ steps.buildx.outputs.name }} |
69 | | - push: false |
70 | | - cache-from: type=registry,ref=${{ secrets.DOCKER_HUB_IMAGE_USERNAME || env.USERNAME }}/infinitime-build:buildcache |
| 41 | + tags: ${{ secrets.DOCKERHUB_USERNAME }}/guardian-beacon:latest |
0 commit comments