Skip to content

Build and deploy documentation #36

Build and deploy documentation

Build and deploy documentation #36

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.ref == 'refs/heads/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.ref == 'refs/heads/main' }}
- name: Set short version
id: vars
run: echo "version_short=${{ github.event.inputs.ref:0:3 }}" >> $GITHUB_OUTPUT

Check failure on line 57 in .github/workflows/build-and-deploy.yml

View workflow run for this annotation

GitHub Actions / Build and deploy documentation

Invalid workflow file

The workflow is not valid. .github/workflows/build-and-deploy.yml (Line: 57, Col: 14): Unexpected symbol: 'ref:0:3'. Located at position 21 within expression: github.event.inputs.ref:0:3
if: ${{ github.ref != 'refs/heads/main' }}
- name: Build documentation html (latest)
run: npm run docs:build
env:
VERSION: "/latest/"
working-directory: .
if: ${{ github.ref != 'refs/heads/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.ref != 'refs/heads/main' }}
- name: Build documentation html (v${{steps.vars.outputs.version_short}})
run: npm run docs:build
env:
VERSION: "/v${{steps.vars.outputs.version_short}}/"
working-directory: .
if: ${{ github.ref != 'refs/heads/main' }}
- name: Deploy to server (v${{steps.vars.outputs.version_short}})
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.ref != 'refs/heads/main' }}