From 456ed450c29aea8971b9268905a5909f1fbe0d03 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 12 Jun 2020 09:49:45 +0100 Subject: [PATCH] Add scheduled regeneration CI jobs This mirrors what Homebrew/formulae.brew.sh does and allows the removal of the push job from Homebrew/brew. --- .github/workflows/scheduled.yml | 36 +++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 4 ++-- Gemfile.lock | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/scheduled.yml diff --git a/.github/workflows/scheduled.yml b/.github/workflows/scheduled.yml new file mode 100644 index 000000000..dbba3c4a2 --- /dev/null +++ b/.github/workflows/scheduled.yml @@ -0,0 +1,36 @@ +name: Scheduled regeneration +on: + schedule: + # Once every other hour + - cron: '30 */2 * * *' +jobs: + generate: + if: startsWith( github.repository, 'Homebrew/' ) + runs-on: ubuntu-latest + steps: + - name: Set up Git repository + uses: actions/checkout@master + + - name: Set up Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: '2.6' + + - name: Install RubyGems + run: | + gem install bundler -v "~>1" + bundle install --jobs 4 --retry 3 + + - name: Generate site + run: | + git clone --depth=1 https://github.com/Homebrew/brew + bundle exec rake yard build + + # commit and push generated files + git add docs + + if ! git diff --no-patch --exit-code HEAD -- docs; then + git commit -m "docs: updates from Homebrew/brew" docs + git pull --rebase origin master + git push + fi diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c5a410297..06e958290 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,11 +13,11 @@ jobs: - name: Set up Ruby uses: actions/setup-ruby@v1 with: - version: '>=2.3' + ruby-version: '2.6' - name: Install RubyGems run: | - gem install bundler + gem install bundler -v "~>1" bundle install --jobs 4 --retry 3 - name: Generate site diff --git a/Gemfile.lock b/Gemfile.lock index 16b3083b0..a8e0065cc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -249,4 +249,4 @@ DEPENDENCIES yard BUNDLED WITH - 2.0.1 + 1.17.2