Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use github pages action #981

Merged
merged 3 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/.rvmrc
/TAGS
/html
/_site
/lib/rdoc/rd/block_parser.rb
/lib/rdoc/rd/inline_parser.rb
/lib/rdoc/markdown.rb
Expand Down
12 changes: 1 addition & 11 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require_relative 'lib/rdoc/task'
require 'bundler/gem_tasks'
require 'rake/testtask'

task :docs => :generate
task :test => [:normal_test, :rubygems_test]

PARSER_FILES = %w[
Expand All @@ -23,19 +22,10 @@ task :default => :test
RDoc::Task.new do |doc|
doc.main = 'README.rdoc'
doc.title = "rdoc #{RDoc::VERSION} Documentation"
doc.rdoc_dir = 'html'
doc.rdoc_dir = '_site' # for github pages
doc.rdoc_files = FileList.new %w[lib/**/*.rb *.rdoc doc/rdoc/markup_reference.rb] - PARSER_FILES
end

task ghpages: :rdoc do
`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/*"), "."
end

Rake::TestTask.new(:normal_test) do |t|
t.verbose = true
t.deps = :generate
Expand Down