-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (62 loc) · 1.96 KB
/
docs-release.yml
File metadata and controls
68 lines (62 loc) · 1.96 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
name: Release Docs
on:
pull_request:
types: [closed]
branches:
- 15.x.x
workflow_dispatch:
inputs:
BASELINE:
description: 'Baseline branch of documentation'
required: true
default: '15.x.x'
TARGET_FOLDER:
description: 'Target version folder'
required: true
default: 'next'
type: choice
options:
- 'v15'
- 'next'
jobs:
build-docs:
name: Publish doc
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' ||
(github.event.pull_request.merged == true && contains(join(github.event.pull_request.labels.*.name, ', '), 'release-docs'))
steps:
- name: Process input parameters
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
TARGET_PATH="${{ github.event.inputs.TARGET_FOLDER }}"
else
TARGET_PATH="v15"
fi
echo "TARGET_PATH=$TARGET_PATH" >> "$GITHUB_ENV"
BASELINE_BRANCH=${{ github.event.inputs.BASELINE || github.ref }}
echo "BASELINE_BRANCH=${BASELINE_BRANCH#refs/heads/}" >> "$GITHUB_ENV"
- name: Checkout baseline branch
uses: actions/checkout@v4
with:
ref: ${{ env.BASELINE_BRANCH }}
fetch-depth: 0
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Build site with Jekyll
run: |
bundle exec jekyll build \
--baseurl "/docs/${{ env.TARGET_PATH }}" \
--config _config.yml,_config.deploy.yml
- name: Deploy to gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
publish_branch: gh-pages
destination_dir: ${{ env.TARGET_PATH }}
keep_files: true