Skip to content

Scheduled regeneration #63626

Scheduled regeneration

Scheduled regeneration #63626

Workflow file for this run

name: Scheduled regeneration
on:
push:
paths:
- .github/workflows/scheduled.yml
- Rakefile
- script/**
schedule:
# Every 15 minutes
- cron: "*/15 * * * *"
workflow_dispatch:
concurrency:
group: scheduled-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-cask:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate homebrew/cask data, pages and API
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Check out 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
with:
core: false
cask: true
test-bot: false
- name: Update data for homebrew/cask
run: /usr/bin/rake casks
env:
HOMEBREW_DEVELOPER: 1
- name: Archive data
run: tar czvf data-cask.tar.gz _data/cask/ api/cask/ api/cask-source/ api/cask_tap_migrations.json cask/ api/internal/v3/homebrew-cask.json
- uses: actions/upload-artifact@v4
with:
name: data-cask
path: data-cask.tar.gz
retention-days: 1
generate-core:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate homebrew/core data, pages and API
runs-on: macos-latest
timeout-minutes: 20
steps:
- name: Check out 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
with:
core: true
cask: false
test-bot: false
- name: Update data for homebrew/core
run: /usr/bin/rake formulae
env:
HOMEBREW_DEVELOPER: 1
- name: Archive data
run: tar czvf data-core.tar.gz _data/formula/ _data/formula_canonical.json api/formula/ api/formula_tap_migrations.json formula/ api/internal/v3/homebrew-core.json
- uses: actions/upload-artifact@v4
with:
name: data-core
path: data-core.tar.gz
retention-days: 1
generate-analytics:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate analytics data
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out 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
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
with:
bundler-cache: true
- name: Update analytics data
run: /usr/bin/rake analytics
env:
HOMEBREW_INFLUXDB_TOKEN: ${{ secrets.HOMEBREW_INFLUXDB_READ_TOKEN }}
- name: Archive data
run: tar czvf data-analytics.tar.gz _data/analytics api/analytics
- uses: actions/upload-artifact@v4
with:
name: data-analytics
path: data-analytics.tar.gz
retention-days: 1
generate-samples:
if: startsWith( github.repository, 'Homebrew/' )
name: Generate API samples
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Check out 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
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
with:
bundler-cache: true
- name: Update data for api samples
run: /usr/bin/rake api_samples
- uses: actions/upload-artifact@v4
with:
name: api-samples
path: _includes/api-samples/
retention-days: 1
build:
needs: [generate-cask, generate-core, generate-analytics, generate-samples]
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
with:
core: false
cask: false
test-bot: false
- name: Set up Ruby
uses: ruby/setup-ruby@cacc9f1c0b3f4eb8a16a6bb0ed10897b43b9de49 # v1.176.0
with:
bundler-cache: true
- uses: actions/download-artifact@v4
- name: Move artifacts into place
run: |
tar xvf data-analytics/data-analytics.tar.gz
tar xvf data-cask/data-cask.tar.gz
tar xvf data-core/data-core.tar.gz
mv -v api-samples _includes/api-samples
- name: Build site
run: bundle exec jekyll build
- name: Validate build
run: ./script/validate-build.rb
- name: Sign API
env:
JWS_SIGNING_KEY_ID: homebrew-1
JWS_SIGNING_KEY: ${{ secrets.JWS_HOMEBREW_1 }}
run: ./script/sign-json.rb
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
needs: build
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 issues
needs:
[
generate-cask,
generate-core,
generate-analytics,
generate-samples,
build,
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/formulae.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="formulae.brew.sh deployment failed!"
ISSUE_BODY="The most recent [formulae.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 [formulae.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