Skip to content

Commit 32aec53

Browse files
authored
Merge pull request #276 from crasbe/pr/workflow_on_fork
.github/workflows: Check Secrets and update actions for NodeJS 24 Compilance
2 parents b825fd8 + 1407d43 commit 32aec53

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/build.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,35 +33,53 @@ on:
3333
workflow_dispatch:
3434

3535
jobs:
36+
check-secret:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
secret-configured: ${{ steps.secret-exists-check.outputs.defined }}
40+
steps:
41+
- name: Check if Secret is configured
42+
id: secret-exists-check
43+
# check if the secrets are configured before running the tasks
44+
# see: https://stackoverflow.com/a/70249520
45+
shell: bash
46+
run: |
47+
if [ "${{ secrets.DOCKER_REGISTRY }}" != '' ]; then
48+
echo "defined=true" >> $GITHUB_OUTPUT;
49+
else
50+
echo "defined=false" >> $GITHUB_OUTPUT;
51+
fi
52+
3653
build-test:
3754
name: Build and Test
3855
runs-on: ubuntu-latest
56+
needs: [check-secret]
3957
env:
4058
RIOT_BRANCH: '2026.04-branch'
4159
VERSION_TAG: '2026.07'
4260
DOCKER_REGISTRY: "${{ secrets.DOCKER_REGISTRY || 'local' }}"
4361

4462
steps:
4563
- name: Checkout
46-
uses: actions/checkout@v2
64+
uses: actions/checkout@main
4765
with:
4866
lfs: 'true'
4967

5068
- name: Set up Docker Buildx
51-
uses: docker/setup-buildx-action@v1
69+
uses: docker/setup-buildx-action@v4
5270
with:
5371
driver: docker
5472

5573
- name: Build riotdocker-base
56-
uses: docker/build-push-action@v2
74+
uses: docker/build-push-action@v7
5775
with:
5876
context: ./riotdocker-base
5977
tags: |
6078
${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
6179
${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}
6280
6381
- name: Build static-test-tools
64-
uses: docker/build-push-action@v2
82+
uses: docker/build-push-action@v7
6583
with:
6684
context: ./static-test-tools
6785
tags: |
@@ -77,7 +95,7 @@ jobs:
7795
echo "RIOTBUILD_VERSION=$(git describe --always)" >> $GITHUB_ENV
7896
7997
- name: Build riotbuild
80-
uses: docker/build-push-action@v2
98+
uses: docker/build-push-action@v7
8199
with:
82100
context: ./riotbuild
83101
tags: |
@@ -90,7 +108,7 @@ jobs:
90108
RIOTBUILD_VERSION=${{ env.RIOTBUILD_VERSION }}
91109
92110
- name: Checkout RIOT
93-
uses: actions/checkout@v2
111+
uses: actions/checkout@main
94112
with:
95113
repository: RIOT-OS/RIOT
96114
ref: ${{ env.RIOT_BRANCH }}
@@ -173,7 +191,7 @@ jobs:
173191
./dist/tools/ci/static_tests.sh
174192
175193
- name: Build murdock worker
176-
uses: docker/build-push-action@v2
194+
uses: docker/build-push-action@v7
177195
with:
178196
context: ./murdock-worker
179197
tags: |
@@ -183,14 +201,14 @@ jobs:
183201
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
184202
185203
- name: Login to DockerHub
186-
if: "${{ github.ref == 'refs/heads/master' }}"
187-
uses: docker/login-action@v1
204+
if: "${{ github.ref == 'refs/heads/master' && needs.check-secret.outputs.secret-configured == 'true' }}"
205+
uses: docker/login-action@v4
188206
with:
189207
username: ${{ secrets.DOCKERHUB_USERNAME }}
190208
password: ${{ secrets.DOCKERHUB_TOKEN }}
191209

192210
- name: Push Images
193-
if: "${{ github.ref == 'refs/heads/master' }}"
211+
if: "${{ github.ref == 'refs/heads/master' && needs.check-secret.outputs.secret-configured == 'true' }}"
194212
run: |
195213
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
196214
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}

0 commit comments

Comments
 (0)