Harden GitHub workflows

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-06-12 17:35:21 +02:00
parent 994553bfd7
commit d4a45836be
3 changed files with 32 additions and 8 deletions

View File

@@ -19,6 +19,7 @@ on:
branches: [ "main" ] branches: [ "main" ]
schedule: schedule:
- cron: '23 5 * * 4' - cron: '23 5 * * 4'
workflow_dispatch:
jobs: jobs:
analyze: analyze:
@@ -39,11 +40,13 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
with:
persist-credentials: false
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 uses: github/codeql-action/init@v3
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@@ -70,4 +73,4 @@ jobs:
./workflows/autobuild.sh ${{ matrix.mode }} ./workflows/autobuild.sh ${{ matrix.mode }}
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 uses: github/codeql-action/analyze@v3

View File

@@ -5,34 +5,49 @@ on:
- cron: '0 2 * * *' - cron: '0 2 * * *'
workflow_dispatch: workflow_dispatch:
permissions:
contents: write
jobs: jobs:
nightly: nightly:
name: Deploy nightly name: Deploy nightly
permissions:
contents: write
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
refs: [main] refs: [main]
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
SIGNING_KEY_PATH: ${{ github.workspace }}/../private.pem
steps: steps:
- name: Validate signing secret
run: |
test -n "${{ secrets.PRIVATE_KEY_B64 }}" || {
echo "PRIVATE_KEY_B64 is required for nightly signed releases." >&2
exit 1
}
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
ref: ${{ matrix.refs }} ref: ${{ matrix.refs }}
submodules: 'recursive' submodules: 'recursive'
persist-credentials: false
- name: Restore private key - name: Restore private key
run: | run: |
echo "${{ secrets.PRIVATE_KEY_B64 }}" | base64 -d > private.pem echo "${{ secrets.PRIVATE_KEY_B64 }}" | base64 -d > "${SIGNING_KEY_PATH}"
chmod 600 private.pem chmod 600 "${SIGNING_KEY_PATH}"
- name : Build - name : Build
env: env:
PICO_SDK_PATH: ../pico-sdk PICO_SDK_PATH: ../pico-sdk
SECURE_BOOT_PKEY: ../private.pem SECURE_BOOT_PKEY: ${{ github.workspace }}/../private.pem
run: | run: |
./workflows/autobuild.sh pico ./workflows/autobuild.sh pico
./build_pico_openpgp.sh --no-eddsa ./build_pico_openpgp.sh --no-eddsa
./workflows/autobuild.sh esp32 ./workflows/autobuild.sh esp32
- name: Delete private key - name: Delete private key
run: rm private.pem if: always()
run: rm -f "${SIGNING_KEY_PATH}"
- name: Update nightly release - name: Update nightly release
uses: pyTooling/Actions/releaser@v6.7.0 uses: pyTooling/Actions/releaser@v6.7.0
with: with:

View File

@@ -21,16 +21,22 @@ on:
schedule: schedule:
- cron: '23 5 * * 4' - cron: '23 5 * * 4'
permissions:
contents: read
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: read
steps: steps:
- name: Checkout repository and submodules - name: Checkout repository and submodules
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
submodules: recursive submodules: recursive
persist-credentials: false
- name: Build in container - name: Build in container
run: ./tests/build-in-docker.sh run: ./tests/build-in-docker.sh
- name: Start emulation and test - name: Start emulation and test