Skip to content

Commit e47af6c

Browse files
authored
Merge pull request #747 from raspberrypi/develop
Harden GitHub Actions and fix note/tip issue
2 parents 9407b0e + 2774bb8 commit e47af6c

8 files changed

Lines changed: 76 additions & 27 deletions

File tree

‎.github/actions/deploy-action/action.yml‎

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,40 @@ inputs:
3232
runs:
3333
using: "composite"
3434
steps:
35-
- name: Configure ssh-agent for subsequent steps
36-
run: echo "SSH_AUTH_SOCK=${{ runner.temp }}/ssh_agent.sock" >> $GITHUB_ENV
37-
shell: bash
38-
3935
- name: Start ssh-agent with SSH key
36+
env:
37+
SSH_AUTH_SOCK: ${{ runner.temp }}/ssh_agent.sock
38+
PRIVATE_SSH_KEY: ${{ inputs.private_ssh_key }}
4039
run: |
41-
ssh-agent -a $SSH_AUTH_SOCK
42-
ssh-add - <<< "${{ inputs.private_ssh_key }}"
40+
ssh-agent -a "$SSH_AUTH_SOCK"
41+
ssh-add - <<< "$PRIVATE_SSH_KEY"
4342
shell: bash
4443

4544
- name: Populate known hosts
45+
env:
46+
KNOWN_HOSTS: ${{ inputs.known_hosts }}
4647
run: |
4748
mkdir -m 700 -p ~/.ssh
48-
printf "${{ inputs.known_hosts }}" >> ~/.ssh/known_hosts
49+
printf "$KNOWN_HOSTS" >> ~/.ssh/known_hosts
4950
chmod 600 ~/.ssh/known_hosts
5051
shell: bash
5152

5253
- name: Deploy to primary server
53-
run: rsync -avz --delete -e 'ssh -J ${{ inputs.bastion_host }}' ${{ inputs.source }} ${{ inputs.primary_host }}:${{ inputs.destination }}
54+
env:
55+
SSH_AUTH_SOCK: ${{ runner.temp }}/ssh_agent.sock
56+
BASTION_HOST: ${{ inputs.bastion_host }}
57+
HOST: ${{ inputs.primary_host }}
58+
SOURCE: ${{ inputs.source }}
59+
DESTINATION: ${{ inputs.destination }}
60+
run: rsync -avz --delete -e "ssh -J $BASTION_HOST" "$SOURCE" "$HOST:$DESTINATION"
5461
shell: bash
5562

5663
- name: Deploy to secondary server
57-
run: rsync -avz --delete -e 'ssh -J ${{ inputs.bastion_host }}' ${{ inputs.source }} ${{ inputs.secondary_host }}:${{ inputs.destination }}
64+
env:
65+
SSH_AUTH_SOCK: ${{ runner.temp }}/ssh_agent.sock
66+
BASTION_HOST: ${{ inputs.bastion_host }}
67+
HOST: ${{ inputs.secondary_host }}
68+
SOURCE: ${{ inputs.source }}
69+
DESTINATION: ${{ inputs.destination }}
70+
run: rsync -avz --delete -e "ssh -J $BASTION_HOST" "$SOURCE" "$HOST:$DESTINATION"
5871
shell: bash

‎.github/workflows/build-and-deploy.yml‎

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,31 @@ on:
1414
jobs:
1515
build:
1616
runs-on: [self-hosted, web]
17+
permissions:
18+
contents: read
19+
outputs:
20+
artifact-id: ${{ steps.upload.outputs.artifact-id }}
1721
steps:
18-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
22+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1923
with:
2024
persist-credentials: false
2125
submodules: recursive
22-
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
26+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
2327
with:
2428
python-version: 3.14
2529
- name: Install Python dependencies
2630
run: |
2731
pip3 install --upgrade pip setuptools wheel
2832
pip3 install -r ./requirements.txt
29-
- uses: ruby/setup-ruby@984c0c890880bbf811283d6f09c4607c62d210a4
33+
- uses: ruby/setup-ruby@14594264cd68ce8a2345dd349bc3d138a4ef85c8 # v1.327.0
3034
with:
3135
ruby-version: 3.2
3236
bundler-cache: true
3337
- name: Install Ninja
3438
run: pip3 install ninja==1.10.2.4
3539
- name: Install arm-none-eabi-gcc GNU Arm Embedded Toolchain
3640
if: ${{ inputs.deploy }}
37-
uses: carlosperate/arm-none-eabi-gcc-action@98c40e51546516419841748d3210c290df0d2c6c
41+
uses: carlosperate/arm-none-eabi-gcc-action@98c40e51546516419841748d3210c290df0d2c6c # v1.13.0
3842
- name: Install Doxygen
3943
if: ${{ inputs.deploy }}
4044
run: |
@@ -49,7 +53,8 @@ jobs:
4953
run: make build_doxygen_adoc
5054
- name: Build documentation
5155
run: make -j 2
52-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
56+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
57+
id: upload
5358
if: ${{ inputs.deploy }}
5459
with:
5560
name: documentation
@@ -62,20 +67,19 @@ jobs:
6267
needs: build
6368
if: ${{ inputs.deploy }}
6469
runs-on: ubuntu-latest
70+
permissions:
71+
actions: write
72+
contents: read
6573
environment:
6674
name: ${{ inputs.environment }}
6775
url: ${{ inputs.url }}
6876
steps:
69-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
70-
with:
71-
persist-credentials: false
72-
sparse-checkout: .github/actions
73-
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
77+
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
7478
with:
7579
name: documentation
7680
path: documentation/html
7781
- name: Deploy to Mythic Beasts
78-
uses: ./.github/actions/deploy-action
82+
uses: $/.github/actions/deploy-action
7983
with:
8084
private_ssh_key: ${{ secrets.DEPLOY_SSH_KEY }}
8185
known_hosts: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
@@ -84,3 +88,8 @@ jobs:
8488
secondary_host: ${{ secrets.DEPLOY_SECONDARY_HOST }}
8589
source: documentation/html/
8690
destination: /
91+
- name: Delete the uploaded build
92+
env:
93+
GH_TOKEN: ${{ github.token }}
94+
ARTIFACT_ID: ${{ needs.build.outputs.artifact-id }}
95+
run: gh api --method DELETE "repos/$GITHUB_REPOSITORY/actions/artifacts/$ARTIFACT_ID"

‎.github/workflows/build.yml‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,24 @@ on:
1212
- develop
1313
pull_request:
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
build:
17-
uses: ./.github/workflows/build-and-deploy.yml
20+
uses: $/.github/workflows/build-and-deploy.yml
21+
permissions:
22+
contents: read
23+
actions: write
1824
if: ${{ github.ref != 'refs/heads/develop' && github.ref != 'refs/heads/master' }}
1925
with:
2026
deploy: false
2127

2228
staging-build:
23-
uses: ./.github/workflows/build-and-deploy.yml
29+
uses: $/.github/workflows/build-and-deploy.yml
30+
permissions:
31+
contents: read
32+
actions: write
2433
if: ${{ github.ref == 'refs/heads/develop' }}
2534
with:
2635
deploy: true
@@ -29,7 +38,10 @@ jobs:
2938
secrets: inherit
3039

3140
production-build:
32-
uses: ./.github/workflows/build-and-deploy.yml
41+
uses: $/.github/workflows/build-and-deploy.yml
42+
permissions:
43+
contents: read
44+
actions: write
3345
if: ${{ github.ref == 'refs/heads/master' }}
3446
with:
3547
deploy: true

‎.github/workflows/check_cr.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ on:
44
push:
55
pull_request:
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
check-line-endings:
912
runs-on: ubuntu-latest
1013
steps:
1114
- name: Checkout
12-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
15+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
16+
with:
17+
persist-credentials: false
1318

1419
- name: Check line endings
1520
run: |

‎.github/workflows/mirror.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ on:
66
- master
77
workflow_dispatch:
88

9+
permissions: {}
10+
911
jobs:
1012
mirror:
1113
runs-on: ubuntu-latest
1214
environment: mirror
1315
steps:
14-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
16+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
1517
with:
1618
ref: master
1719
token: ${{ secrets.DOCUMENTATION_REPO_TOKEN }}

‎.github/workflows/stale.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
pull-requests: write
1414

1515
steps:
16-
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93
16+
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'

‎.github/zizmor.yml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
secrets-inherit:
3+
ignore:
4+
- build.yml
5+
artipacked:
6+
ignore:
7+
- mirror.yml

‎documentation/asciidoc/computers/linux_kernel/building.adoc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ If you don't provide a matching filename, you must specify the ramdisk using an
243243
initramfs <filename> followkernel
244244
----
245245
====
246+
[NOTE]
246247

247-
NOTE: Building and updating `initramfs` is considered an advanced technique that's undertaken only by experienced users. It isn't officially supported by Raspberry Pi and we therefore don't provide instructions for it.
248+
Building and updating `initramfs` is considered an advanced technique that's undertaken only by experienced users. It isn't officially supported by Raspberry Pi and we therefore don't provide instructions for it.
248249

249250
=== Cross-compile the kernel
250251

0 commit comments

Comments
 (0)