Build and deploy documentation #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 (latest) | |
run: npm run docs:build | |
env: | |
VERSION: "/latest/" | |
working-directory: . | |
- name: Deploy to server (latest) | |
uses: easingthemes/ssh-deploy@v3.4.3 | |
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/" | |
- name: Build documentation html (v2.1) | |
run: npm run docs:build | |
env: | |
VERSION: "/v2.1/" | |
working-directory: . | |
- name: Deploy to server (v2.1) | |
uses: easingthemes/ssh-deploy@v3.4.3 | |
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 }}/v2.1/" |