From 2e7de2d28ebf78cb7af578372b49b9de9841f521 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 12 Jun 2025 15:49:54 +0900 Subject: [PATCH 1/3] Create documentation generated by rdoc with GitHub Actions --- .github/workflows/gh-pages.yml | 46 ++++++++++++++++++++++++++++++++++ .gitignore | 1 + Rakefile | 8 ++++++ 3 files changed, 55 insertions(+) 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 00000000..e7ee429a --- /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@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0 + with: + ruby-version: '3.4' + bundler-cache: true + - name: Setup Pages + id: pages + uses: actions/configure-pages@v5 + - name: Build with RDoc + # Outputs to the './_site' directory by default + run: rake rdoc + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + 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@v4 diff --git a/.gitignore b/.gitignore index c09e7b93..d48a1b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ /vendor/x64-mswin64* /ext/curses/Makefile .ruby-version +_site diff --git a/Rakefile b/Rakefile index bdfdfddd..b544a1f7 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,11 @@ require "bundler" Bundler::GemHelper.install_tasks + +require "rdoc/task" +RDoc::Task.new do |doc| + doc.main = "README.md" + doc.title = "Curses: A Ruby binding for curses, ncurses, and PDCurses." + doc.rdoc_files = FileList.new %w[ext lib README.md BSDL COPYING] + doc.rdoc_dir = "_site" # for github pages +end From e14012329bb1c7fc8b56b287c05d2e9814b80f15 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 12 Jun 2025 15:52:30 +0900 Subject: [PATCH 2/3] RDoc is not available since Ruby 3.5+ --- .github/workflows/gh-pages.yml | 2 ++ Rakefile | 15 +++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index e7ee429a..989e48e0 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -28,6 +28,8 @@ jobs: - name: Setup Pages id: pages uses: actions/configure-pages@v5 + - name: Install dependencies + run: gem install rdoc - name: Build with RDoc # Outputs to the './_site' directory by default run: rake rdoc diff --git a/Rakefile b/Rakefile index b544a1f7..9b3c6fff 100644 --- a/Rakefile +++ b/Rakefile @@ -2,10 +2,13 @@ require "bundler" Bundler::GemHelper.install_tasks -require "rdoc/task" -RDoc::Task.new do |doc| - doc.main = "README.md" - doc.title = "Curses: A Ruby binding for curses, ncurses, and PDCurses." - doc.rdoc_files = FileList.new %w[ext lib README.md BSDL COPYING] - doc.rdoc_dir = "_site" # for github pages +begin + require "rdoc/task" + RDoc::Task.new do |doc| + doc.main = "README.md" + doc.title = "Curses: A Ruby binding for curses, ncurses, and PDCurses." + doc.rdoc_files = FileList.new %w[ext lib README.md BSDL COPYING] + doc.rdoc_dir = "_site" # for github pages + end +rescue LoadError end From 22d250de683b2a1efacf6459ef3228dd5257f5b4 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 12 Jun 2025 16:01:23 +0900 Subject: [PATCH 3/3] Use the latest version of ruby/setup-ruby --- .github/workflows/gh-pages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 989e48e0..6cdd1aea 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -21,7 +21,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Setup Ruby - uses: ruby/setup-ruby@32110d4e311bd8996b2a82bf2a43b714ccc91777 # v1.221.0 + uses: ruby/setup-ruby@a4effe49ee8ee5b8b5091268c473a4628afb5651 # v1.245.0 with: ruby-version: '3.4' bundler-cache: true