fix yard on some rubies (#355) #336
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy YARD docs to Pages | |
on: | |
push: | |
branches: ["main"] | |
tags: ["v*"] | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
ref_name: | |
required: true | |
type: string | |
ref_type: | |
required: true | |
type: string | |
env: | |
RUBY_VERSION: 3.1.3 | |
BUNDLE_LOCKFILE: active | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
concurrency: | |
group: yardoc-${{ inputs.ref_name || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.ref_name || github.ref_name }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ env.RUBY_VERSION }} | |
bundler-cache: true | |
- name: Build YARD docs | |
run: bin/yardoc | |
- name: Determine Destination Dir | |
id: destination_dir | |
run: ruby -e 'ref_name = "${{ inputs.ref_name || github.ref_name }}"; ref_name = ref_name[1..-1].split(".")[0..1].join(".") if "${{ inputs.ref_type || github.ref_type }}" == "tag"; puts "DESTINATION_DIR=#{ref_name}"' >> $GITHUB_OUTPUT | |
- name: Avoid race condition with push to main branch | |
if: ${{ (inputs.ref_type || github.ref_type) == 'tag' }} | |
run: sleep 15 | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/yard/ | |
destination_dir: ${{ steps.destination_dir.outputs.DESTINATION_DIR }} | |
user_name: 'github-actions[bot]' | |
user_email: '41898282+github-actions[bot]@users.noreply.github.com' |