-
Notifications
You must be signed in to change notification settings - Fork 0
Add gh actions workflow for building rpi image #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: first-impl
Are you sure you want to change the base?
Conversation
… into gh-actions-rpi-image
- Create composite action at .github/actions/build-rpi-image/action.yml - Add configurable source_repo and version_prefix inputs - Implement release download logic with tag prefix matching - Place downloaded zip at correct path for updatecli scripts - Create test workflow that calls action with jamtools/jamscribe and vjamscribe- prefix Co-authored-by: Michael Kochell <mickmister@users.noreply.github.com>
The GitHub App doesn't have workflow permissions, so removing the test workflow file. The composite action is ready to use.
mickmister
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude We need to do some find/replace or something to inject the action params into the updatecli file. And make sure GITHUB_TOKEN secret is available at runtime
| spec: | ||
| owner: jamtools | ||
| repository: jamscribe | ||
| token: "{{ requiredEnv `GITHUB_TOKEN` }}" | ||
| versionfilter: | ||
| kind: regex | ||
| pattern: "vjamscribe-.*$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be parameterized from the github action's parameters
| kind: shell | ||
| sourceid: newRelease | ||
| spec: | ||
| command: /home/pi/code/scripts/run_from_github_release.sh jamtools jamscribe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same with this
| spec: | ||
| owner: jamtools | ||
| repository: jamscribe | ||
| token: "{{ requiredEnv `GITHUB_TOKEN` }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to make sure we place this value into an env var available in the systemd service running this
|
Claude finished @mickmister's task —— View job Parameterizing UpdateCLI Configuration ✅I've successfully parameterized the updatecli configuration to use the GitHub action's parameters and ensure GITHUB_TOKEN is available at runtime. Todo List:
Changes MadeI've successfully added parameterization to the GitHub composite action. The key changes: Added parameterization step in
Environment Variables:
Usage Example: uses: ./.github/actions/build-rpi-image
with:
source_repo: 'jamtools/jamscribe'
version_prefix: 'vjamscribe-'
github_token: ${{ secrets.GITHUB_TOKEN }}The updatecli configuration will be automatically updated to use those values instead of the hardcoded ones, and the GITHUB_TOKEN will be securely available to the systemd service at runtime. --- | Branch: gh-actions-rpi-image | |
…lity - 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>
| - name: Find latest matching release by tag prefix | ||
| id: find_release | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ inputs.github_token }} | ||
| run: | | ||
| PREFIX="${{ inputs.version_prefix }}" | ||
| latest=$(gh release list --repo "${{ inputs.source_repo }}" --limit 100 --json tagName,publishedAt \ | ||
| | jq -r --arg prefix "$PREFIX" ' | ||
| map(select(.tagName | startswith($prefix))) | ||
| | sort_by(.publishedAt) | ||
| | last | ||
| | if . == null then "none" else .tagName end | ||
| ') | ||
| echo "latest_tag=$latest" >> $GITHUB_OUTPUT | ||
| echo "Found latest release: $latest" | ||
|
|
||
| - name: Download artifact from latest release | ||
| if: steps.find_release.outputs.latest_tag != 'none' | ||
| uses: blauqs/actions-download-asset@master | ||
| with: | ||
| repo: ${{ inputs.source_repo }} | ||
| version: ${{ steps.find_release.outputs.latest_tag }} | ||
| file: dist.zip | ||
| out: previous_release.zip | ||
| token: ${{ inputs.github_token }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude I think we need to strip the v from the version since it seems blauqs/actions-download-asset is prepending an additional one
ci fail logs:
Run PREFIX="vjamscribe-"
Found latest release: vjamscribe-2
Run blauqs/actions-download-asset@master
Error: Error: could not find a release with the prefix/version 'vvjamscribe-2' in 'jamtools/jamscribe'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @mickmister's task —— View job
Fixed version stripping issue ✅
Todo List:
- Read the current GitHub action to understand version handling
- Identify where version stripping should occur
- Fix the version format before passing to download action
- Test and commit the fix
What I Fixed
The issue was in the JQ query that extracts the tag name from GitHub releases. The blauqs/actions-download-asset action automatically prepends a "v" to whatever version it receives, but our tags already include the "v" (e.g., "vjamscribe-2").
The fix: Changed .tagName to .tagName[1:] in the JQ query on line 54 of .github/actions/build-rpi-image/action.yml. This strips the first character from the tag name.
Result:
- Before: Tag "vjamscribe-2" → Download action searches for "vvjamscribe-2" ❌
- After: Tag "vjamscribe-2" → "jamscribe-2" → Download action searches for "vjamscribe-2" ✅
The fix has been committed and pushed. The next CI run should successfully download the release artifact without the double "v" prefix error.
The blauqs/actions-download-asset action prepends a 'v' to the version, so we need to strip the first character from our tag name (e.g., 'vjamscribe-2' becomes 'jamscribe-2') to avoid 'vvjamscribe-2' format. Co-authored-by: Michael Kochell <mickmister@users.noreply.github.com>
… into gh-actions-rpi-image
… into gh-actions-rpi-image
No description provided.