Skip to content

Build and deploy documentation #41

Build and deploy documentation

Build and deploy documentation #41

name: Build and deploy documentation
on:
workflow_dispatch:
inputs:
type:
description: 'Type'
required: false
default: 'heads'
ref:
description: 'Version'
required: true
default: 'main'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Build configs
run: php generate.php "${{ github.event.inputs.type }}" "${{ github.event.inputs.ref }}"
working-directory: .generator
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: '20.x'
- name: Install npm dependencies
run: npm install
- name: Build documentation html (dev/nightly)
run: npm run docs:build
env:
VERSION: "/dev/"
VITE_DEV: 1
working-directory: .
if: ${{ github.event.inputs.ref == 'main' }}
- name: Deploy to server (dev/nightly)
uses: easingthemes/[email protected]
env:
ARGS: "-rltgoDzvO --delete --chown=${{ secrets.WEB_USER }}:${{ secrets.WEB_USER }}"
SOURCE: ".vitepress/dist/"
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "${{ secrets.REMOTE_TARGET }}/dev/"
if: ${{ github.event.inputs.ref == 'main' }}
- name: Set short version
id: vars
run: echo "version_short=$( echo ${{ github.event.inputs.ref }} | cut -c 1-3)" >> $GITHUB_OUTPUT
if: ${{ github.event.inputs.ref != 'main' }}
- name: Build documentation html (latest)
run: npm run docs:build
env:
VERSION: "/latest/"
working-directory: .
if: ${{ github.event.inputs.ref != 'main' }}
- name: Deploy to server (latest)
uses: easingthemes/[email protected]
env:
ARGS: "-rltgoDzvO --delete --chown=${{ secrets.WEB_USER }}:${{ secrets.WEB_USER }}"
SOURCE: ".vitepress/dist/"
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "${{ secrets.REMOTE_TARGET }}/latest/"
if: ${{ github.event.inputs.ref != 'main' }}
- name: Build documentation html (short release version)
run: npm run docs:build
env:
VERSION: "/v${{steps.vars.outputs.version_short}}/"
working-directory: .
if: ${{ github.event.inputs.ref != 'main' }}
- name: Deploy to server (short release version)
uses: easingthemes/[email protected]
env:
ARGS: "-rltgoDzvO --delete --chown=${{ secrets.WEB_USER }}:${{ secrets.WEB_USER }}"
SOURCE: ".vitepress/dist/"
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "${{ secrets.REMOTE_TARGET }}/v${{steps.vars.outputs.version_short}}/"
if: ${{ github.event.inputs.ref != 'main' }}