-
-
Notifications
You must be signed in to change notification settings - Fork 5
56 lines (51 loc) · 1.66 KB
/
yardoc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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'