Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/components_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---

name: Update components

on:
workflow_call: {}
schedule:
- cron: "0 0 * * *"

env:
GIT_AUTHOR_NAME: OpenVoxProjectBot
GIT_AUTHOR_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com
GIT_COMMITTER_NAME: OpenVoxProjectBot
GIT_COMMITTER_EMAIL: 215568489+OpenVoxProjectBot@users.noreply.github.com
SSH_AUTH_SOCK: /tmp/ssh_agent.sock

permissions:
contents: read

jobs:
update_gems:
name: 'Update gem components'
runs-on: ubuntu-24.04
if: github.repository_owner == 'OpenVoxProject'
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Add SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.OPENVOXBOT_SSH_PRIVATE_KEY }}" > ~/.ssh/github_actions
chmod 600 ~/.ssh/github_actions
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add ~/.ssh/github_actions
- name: Setup git
run: |
git config --global user.email "$GIT_AUTHOR_EMAIL"
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/github_actions
git config --global commit.gpgsign true
git config --global tag.gpgsign true
- name: Display bundle environment
run: bundle env
- name: Check for gem updates
run: vox:update_gems
- name: Create pull Request
uses: peter-evans/create-pull-request@v8
with:
commit-message: "Update Ruby components"
signoff: true
branch: "component-update"
delete-branch: true
title: "Update Ruby components"
labels: skip-changelog
token: '${{ secrets.OPENVOXBOT_COMMIT_AND_PRS }}'
assignees: '${{ github.triggering_actor }}'
author: '${{ env.GIT_AUTHOR_NAME }} <${{ env.GIT_AUTHOR_EMAIL }}>'
committer: '${{ env.GIT_COMMITTER_NAME }} <${{ env.GIT_COMMITTER_EMAIL }}>'
Comment thread
nmburgan marked this conversation as resolved.
body: |
Automated gem update task
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ Where:
## Updating rubygem components

This repo includes a rake task that will use the RubyGems API to update all rubygem components, including adding any missing runtime dependencies.

```
$ bundle exec rake vox:update_gems
```

This is the all-in-one task, which will also commit your changes.
However, there is also `vox:update_gems_wo_commit`, which does the same except committing changes.
There's a CI workflow that runs daily + on demand.
It raises a PR / updates an existing PR if the rake task finds any changes.

In each `rubygem-*.rb` file in `configs/components`, you will find a "magic" block near the top. For example:

```
### Maintained by update_gems automation ###
pkg.version '2.14.0'
Expand Down
47 changes: 28 additions & 19 deletions tasks/update_gems.rake
Original file line number Diff line number Diff line change
Expand Up @@ -483,30 +483,39 @@ def ensure_no_uncommitted_changes
exit 1
end

namespace :vox do
desc 'Update rubygem components and print a summary of changes'
task :update_gems do
ensure_no_uncommitted_changes
def check_and_summarize(commit: true)
ensure_no_uncommitted_changes

progress_print('Updating components and creating missing ones')
update_all_components_and_create_missing
progress_clear
progress_print('Updating components and creating missing ones')
update_all_components_and_create_missing
progress_clear

progress_print('Ensuring project component dependencies')
ensure_projects_have_component_deps
progress_clear
progress_print('Ensuring project component dependencies')
ensure_projects_have_component_deps
progress_clear

summary = build_summary
summary = build_summary

if summary.empty?
puts 'No updates to any rubygem components needed'
exit 0
end
if summary.empty?
puts 'No updates to any rubygem components needed'
exit 0
end

puts summary
puts summary

git_add
git_commit(summary)
git_summary
return unless commit

git_add
git_commit(summary)
git_summary
end
namespace :vox do
desc 'Update rubygem components, commit them and print a summary of changes'
task :update_gems do
check_and_summarize(commit: true)
end
desc 'Update rubygem components, commit them and print a summary of changes'
task :update_gems_wo_commit do
Comment thread
nmburgan marked this conversation as resolved.
check_and_summarize(commit: false)
end
end
Loading