Skip to content

Commit a4fd67b

Browse files
authored
Update docker.yml
1 parent 3885320 commit a4fd67b

1 file changed

Lines changed: 28 additions & 57 deletions

File tree

.github/workflows/docker.yml

Lines changed: 28 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,41 @@
1-
name: Build and push Docker image
1+
name: Build (no Docker required)
22

33
on:
44
push:
5-
branches: [ main ]
6-
paths:
7-
- 'docker/**'
5+
branches: [ main, master, guardian-beacon ]
86
pull_request:
9-
branches: [ main ]
10-
paths:
11-
- 'docker/**'
12-
# Allows you to run this workflow manually from the Actions tab
13-
workflow_dispatch:
147

158
jobs:
169
build:
17-
runs-on: ubuntu-22.04
18-
env:
19-
USERNAME: infinitime
20-
steps:
21-
- uses: actions/checkout@v3
10+
runs-on: ubuntu-latest
2211

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
2615
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
2917

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
3322
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
5038
with:
51-
context: ./docker/
52-
file: ./docker/Dockerfile
53-
platforms: linux/amd64,linux/arm64
54-
builder: ${{ steps.buildx.outputs.name }}
39+
context: .
5540
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

Comments
 (0)