Skip to content

Commit

Permalink
Merge pull request #477 from ruby/gh-pages-actions
Browse files Browse the repository at this point in the history
Use GitHub Pages Action for generating rdoc page
  • Loading branch information
hsbt committed Mar 1, 2023
2 parents 672962c + 3199888 commit f1670e4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 10 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy RDoc site to Pages

on:
push:
branches: [ 'master' ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@92aece5fc9c784ab66851c1e702b1bd5885a51f2 # v1.139.0
with:
ruby-version: '3.2'
bundler-cache: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with RDoc
# Outputs to the './_site' directory by default
run: bundle exec rake rdoc
- name: Upload artifact
uses: actions/upload-pages-artifact@v1

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
11 changes: 1 addition & 10 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ RDoc::Task.new do |doc|
doc.main = "README.rdoc"
doc.title = "Rake -- Ruby Make"
doc.rdoc_files = FileList.new %w[lib MIT-LICENSE doc/**/*.rdoc *.rdoc]
doc.rdoc_dir = "html"
end

task ghpages: :rdoc do
%x[git checkout gh-pages]
require "fileutils"
FileUtils.rm_rf "/tmp/html"
FileUtils.mv "html", "/tmp"
FileUtils.rm_rf "*"
FileUtils.cp_r Dir.glob("/tmp/html/*"), "."
doc.rdoc_dir = "_site" # for github pages
end

task default: :test

0 comments on commit f1670e4

Please sign in to comment.