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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
name: Publish Website
on:
# For some reason, `on: release: ...` didn't work with `nektos/act`
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
publish_website:
description: "Publish guides to website?"
type: boolean
required: true
default: true
publish_version:
description: "If present, pull this GraphQL-Ruby version to rebuild API docs"
required: false
type: string
permissions: {}
jobs:
website:
if: ${{ inputs.publish_website || github.ref_name }}
permissions:
contents: write
name: Publish Website
runs-on: ubuntu-latest
steps:
- name: Checkout master
uses: actions/checkout@v6
- name: Checkout GitHub pages branch
uses: actions/checkout@v6
with:
path: gh-pages
ref: gh-pages
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Build HTML, reindex
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
run: |
bundle exec rake site:fetch_latest site:build_doc site:update_search_index site:clean_html site:build_html
- name: Commit changes as last committer
run: |
git config --global user.name "$(git log --format="%aN" -n 1)"
git config --global user.email "$(git log --format="%aE" -n 1)"
bundle exec rake site:commit_changes
- name: Deploy to GitHub pages via gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
api_docs:
needs: website
if: ${{ inputs.publish_version || github.ref_name }}
permissions:
contents: write
name: Publish API Docs
runs-on: ubuntu-latest
steps:
- name: Checkout release tag
uses: actions/checkout@v6
with:
ref: ${{ env.GITHUB_REF }}
- name: Checkout GitHub pages branch
uses: actions/checkout@v6
with:
path: gh-pages
ref: gh-pages
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
- name: Build API docs
run: |
bundle exec rake site:fetch_latest apidocs:gen_version["${{ inputs.publish_version || env.GITHUB_REF }}"]
- name: Commit changes as rmosolgo
run: |
git config --global user.name rmosolgo
git config --global user.email rdmosolgo@gmail.com
git status
bundle exec rake site:commit_changes
git status
- name: Deploy to GitHub pages via gh-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages
|