Merge pull request #6418 from EricFromCanada/apidoc-workflow

workflows: add `apidoc` workflow for rubydoc.brew.sh
This commit is contained in:
Mike McQuaid 2019-09-04 09:05:57 +01:00 committed by GitHub
commit e71c36ec52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 49 deletions

10
.github/main.workflow vendored
View File

@ -1,10 +0,0 @@
workflow "Push" {
on = "push"
resolves = ["Generate rubydoc.brew.sh"]
}
action "Generate rubydoc.brew.sh" {
uses = "docker://ruby:latest"
runs = ".github/main.workflow.sh"
secrets = ["RUBYDOC_DEPLOY_KEY"]
}

View File

@ -1,36 +0,0 @@
#!/bin/bash
set -e
# silence bundler complaining about being root
mkdir ~/.bundle
echo 'BUNDLE_SILENCE_ROOT_WARNING: "1"' > ~/.bundle/config
# configure git
git config --global user.name "BrewTestBot"
git config --global user.email "homebrew-test-bot@lists.sfconservancy.org"
# setup SSH
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "$RUBYDOC_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
# clone rubydoc.brew.sh with SSH so we can push back
git clone git@github.com:Homebrew/rubydoc.brew.sh
cd rubydoc.brew.sh
# clone latest Homebrew/brew
git clone --depth=1 https://github.com/Homebrew/brew
# run rake to build documentation
gem install bundler
bundle install
bundle exec rake
# commit and push generated files
git add docs
git diff --exit-code HEAD -- docs && exit 0
git commit -m 'docs: update from Homebrew/brew push' docs
git push

38
.github/workflows/apidoc.yml vendored Normal file
View File

@ -0,0 +1,38 @@
name: Generate rubydoc.brew.sh
on:
push:
branches: master
jobs:
apidoc:
runs-on: ubuntu-latest
steps:
- uses: docker://ruby:latest
- uses: Homebrew/actions/git-ssh@master
with:
git_user: BrewTestBot
git_email: homebrew-test-bot@lists.sfconservancy.org
key: ${{ secrets.RUBYDOC_DEPLOY_KEY }}
- run: |
# silence bundler complaining about being root
mkdir ~/.bundle
echo 'BUNDLE_SILENCE_ROOT_WARNING: "1"' > ~/.bundle/config
# clone rubydoc.brew.sh with SSH so we can push back
git clone git@github.com:Homebrew/rubydoc.brew.sh
cd rubydoc.brew.sh
# clone latest Homebrew/brew
git clone --depth=1 https://github.com/Homebrew/brew
# run rake to build documentation
gem install bundler
bundle install
bundle exec rake
# commit and push generated files
git add docs
if ! git diff --exit-code HEAD -- docs; then
git commit -m 'docs: update from Homebrew/brew push' docs
git push
fi

View File

@ -1,12 +1,12 @@
# frozen_string_literal: true
require "formula"
require "cli/parser"
# `brew uses foo bar` returns formulae that use both foo and bar
# If you want the union, run the command twice and concatenate the results.
# The intersection is harder to achieve with shell tools.
require "formula"
require "cli/parser"
module Homebrew
module_function