Skip to content

Scheduled regeneration #35415

Scheduled regeneration

Scheduled regeneration #35415

Workflow file for this run

name: Scheduled regeneration
on:
push:
branches:
- master
pull_request:
schedule:
# Once every hour
- cron: "30 * * * *"
workflow_dispatch:
concurrency:
group: scheduled-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true
jobs:
generate:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate and build documentation site
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: Set up Ruby
uses: ruby/setup-ruby@97e35c5302afcf3f5ac1df3fca9343d32536b286 # v1.184.0
with:
bundler-cache: true
- name: Generate site
run: |
ln -s $(brew --repo) brew
bundle exec rake yard build
- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
deploy:
needs: generate
if: ${{ github.ref_name == 'master' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
outputs:
deploy_url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
deploy-issue:
name: Open/close deploy issue
needs: [generate, deploy]
if: ${{ always() && github.ref_name == 'master' }}
env:
GH_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
REPO: ${{ github.repository }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Find existing deploy failure issue
run: |
EXISTING_ISSUE=$(gh issue list --repo "$REPO" --author BrewTestBot --label 'deploy failure' | awk '{print $1}')
echo "EXISTING_ISSUE=$EXISTING_ISSUE" >> $GITHUB_ENV
echo "WORKFLOW_URL=https://github.com/Homebrew/rubydoc.brew.sh/actions/runs/$RUN_ID" >> $GITHUB_ENV
env:
RUN_ID: ${{ github.run_id }}
- name: Report deploy failure
if: ${{ contains(needs.*.result, 'failure') }}
run: |
ISSUE_TITLE="rubydoc.brew.sh deployment failed!"
ISSUE_BODY="The most recent [rubydoc.brew.sh deployment failed]($WORKFLOW_URL)."
if [ -n "$EXISTING_ISSUE" ]; then
gh issue edit "$EXISTING_ISSUE" --repo "$REPO" --body "$(echo -e "$ISSUE_BODY")"
else
gh issue create --repo "$REPO" --title "$ISSUE_TITLE" --label "deploy failure" --body "$(echo -e "$ISSUE_BODY")"
fi
- name: Report deploy success
if: ${{ needs.deploy.result == 'success' }}
run: |
COMMENT_BODY="The most recent [rubydoc.brew.sh deployment succeeded]($WORKFLOW_URL). Closing issue."
if [ -n "$EXISTING_ISSUE" ]; then
gh issue comment "$EXISTING_ISSUE" --repo "$REPO" --body "$(echo -e "$COMMENT_BODY")"
gh issue close "$EXISTING_ISSUE" --repo "$REPO"
fi