From 3199888286ef2f90a8d0207aa0ab4a896c1f66cf Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 1 Mar 2023 11:59:34 +0900 Subject: [PATCH] Use GitHub Pages Action for generating rdoc page --- .github/workflows/gh-pages.yml | 46 ++++++++++++++++++++++++++++++++++ Rakefile | 11 +------- 2 files changed, 47 insertions(+), 10 deletions(-) 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 000000000..1828e0386 --- /dev/null +++ b/.github/workflows/gh-pages.yml @@ -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 diff --git a/Rakefile b/Rakefile index e03dc6feb..d778df5ff 100644 --- a/Rakefile +++ b/Rakefile @@ -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