Skip to content

Update Upstream

Update Upstream #44

name: Update Upstream
on:
schedule:
- cron: "0 9 * * *" # Daily at 9am UTC
workflow_dispatch: # Allow manual trigger
jobs:
check-and-update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- name: Check for upstream updates
id: update
run: |
if bin/update_upstream; then
if [ -n "$(git status --porcelain)" ]; then
echo "updated=true" >> $GITHUB_OUTPUT
else
echo "updated=false" >> $GITHUB_OUTPUT
fi
else
echo "updated=false" >> $GITHUB_OUTPUT
fi
- name: Run tests
if: steps.update.outputs.updated == 'true'
run: bundle exec rake test
- name: Commit and push
if: steps.update.outputs.updated == 'true'
run: |
VERSION=$(grep -oP 'VERSION = "\K[^"]+' lib/rustywind/ruby/upstream.rb)
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Upgrade rustywind binaries to $VERSION"
git push
- name: Release to RubyGems
if: steps.update.outputs.updated == 'true'
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: |
mkdir -p ~/.gem
echo -e "---\n:rubygems_api_key: $GEM_HOST_API_KEY" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
bundle exec rake release gem_push=yes