From 9bd513b31a6946380ca49225d041b2b502bbfb28 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 1 Mar 2023 11:08:51 +0900 Subject: [PATCH 1/3] Use github-pages action instead of gh-pages branch --- .github/workflows/gh-pages.yml | 48 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + Rakefile | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/gh-pages.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml new file mode 100644 index 0000000000..013a6dbf0b --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -0,0 +1,48 @@ +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 + env: + JEKYLL_ENV: production + - 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 diff --git a/.gitignore b/.gitignore index eb0b44af3c..a2c8d25b1d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /.rvmrc /TAGS /html +/_site /lib/rdoc/rd/block_parser.rb /lib/rdoc/rd/inline_parser.rb /lib/rdoc/markdown.rb diff --git a/Rakefile b/Rakefile index d05714bbd3..3ec317cd26 100644 --- a/Rakefile +++ b/Rakefile @@ -23,7 +23,7 @@ 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 From 09c5bb6471aa9a2451df534a904dc0ff2b69bf4d Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 1 Mar 2023 11:13:04 +0900 Subject: [PATCH 2/3] cleanup needless tasks --- Rakefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Rakefile b/Rakefile index 3ec317cd26..26bb9e373a 100644 --- a/Rakefile +++ b/Rakefile @@ -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[ @@ -27,15 +26,6 @@ RDoc::Task.new do |doc| 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 From 37762e8fd1c2558cf0ae11f333ccfc3a14fb9436 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 1 Mar 2023 11:13:38 +0900 Subject: [PATCH 3/3] Removed jekyll specific variables --- .github/workflows/gh-pages.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 013a6dbf0b..2af4492e62 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -31,8 +31,6 @@ jobs: - name: Build with RDoc # Outputs to the './_site' directory by default run: rake rdoc - env: - JEKYLL_ENV: production - name: Upload artifact uses: actions/upload-pages-artifact@v1