Skip to content

Commit e14dc64

Browse files
Parameterize UpdateCLI configuration and ensure GITHUB_TOKEN availability
- Add parameterization step to composite action that replaces hardcoded values in updatecli config - Extract owner/repo from source_repo input parameter - Create secrets.env file with GITHUB_TOKEN for runtime access by systemd service - Update updatecli config to use dynamic owner, repository, version prefix, and script parameters - Copy parameterized config to expected location at /home/pi/code/updatecli_github_commit.yml 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Michael Kochell <mickmister@users.noreply.github.com>
1 parent 2304d65 commit e14dc64

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/actions/build-rpi-image/action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,37 @@ runs:
9494
mv previous_release.zip repository/src/modules/rpi-deploy/filesystem/home/pi/code/artifacts/dist.zip
9595
echo "Placed release zip at: repository/src/modules/rpi-deploy/filesystem/home/pi/code/artifacts/dist.zip"
9696
97+
- name: Parameterize UpdateCLI configuration
98+
shell: bash
99+
run: |
100+
# Extract owner and repository from source_repo input
101+
OWNER=$(echo "${{ inputs.source_repo }}" | cut -d'/' -f1)
102+
REPOSITORY=$(echo "${{ inputs.source_repo }}" | cut -d'/' -f2)
103+
104+
# Create the directory for secrets
105+
mkdir -p repository/src/modules/rpi-deploy/filesystem/home/pi/code/
106+
107+
# Create secrets.env file with GITHUB_TOKEN
108+
echo "GITHUB_TOKEN=${{ inputs.github_token }}" > repository/src/modules/rpi-deploy/filesystem/home/pi/code/secrets.env
109+
110+
# Parameterize the updatecli configuration file
111+
UPDATECLI_CONFIG="repository/src/modules/rpi-deploy/filesystem/home/pi/updatecli/new_stuff/updatecli.d/updatecli_github_commit.yml"
112+
113+
# Replace hardcoded values with parameterized ones
114+
sed -i "s/owner: jamtools/owner: $OWNER/g" "$UPDATECLI_CONFIG"
115+
sed -i "s/repository: jamscribe/repository: $REPOSITORY/g" "$UPDATECLI_CONFIG"
116+
sed -i "s/pattern: \"vjamscribe-.*\$/pattern: \"${{ inputs.version_prefix }}.*\$/g" "$UPDATECLI_CONFIG"
117+
sed -i "s|run_from_github_release.sh jamtools jamscribe|run_from_github_release.sh $OWNER $REPOSITORY|g" "$UPDATECLI_CONFIG"
118+
119+
# Copy the updatecli config to where the systemd service expects it
120+
cp "$UPDATECLI_CONFIG" "repository/src/modules/rpi-deploy/filesystem/home/pi/code/updatecli_github_commit.yml"
121+
122+
echo "Updated UpdateCLI config with:"
123+
echo " Owner: $OWNER"
124+
echo " Repository: $REPOSITORY"
125+
echo " Version prefix: ${{ inputs.version_prefix }}"
126+
echo " Config copied to: /home/pi/code/updatecli_github_commit.yml"
127+
97128
- name: Download Raspbian Image
98129
shell: bash
99130
run: cd repository/src/image && wget -q -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest'

0 commit comments

Comments
 (0)