Skip to content

feat(guide-3-s7): add T4+ forward reference in SS1 §7.01 #194

feat(guide-3-s7): add T4+ forward reference in SS1 §7.01

feat(guide-3-s7): add T4+ forward reference in SS1 §7.01 #194

name: Deploy Static Docs to VK VM!
on:
push:
branches: [ main ]
workflow_dispatch:
concurrency:
group: vkcloud-static-deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: ./docs
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build static files
run: npm run docs:build
- name: Install SSH tools
run: |
sudo apt-get update -qq
sudo apt-get install -y rsync openssh-client
- name: Configure SSH key
env:
SSH_PRIVATE_KEY: ${{ secrets.VKCS_SSH_KEY_DOCS_VM }}
TARGET_HOST: ${{ secrets.VKCS_SSH_IP_DOCS_VM }}
run: |
mkdir -p ~/.ssh
printf '%s' "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H "$TARGET_HOST" >> ~/.ssh/known_hosts
- name: Prepare VM directory
env:
TARGET_USER: ${{ secrets.VKCS_USER_DOCS_VM }}
TARGET_HOST: ${{ secrets.VKCS_SSH_IP_DOCS_VM }}
run: |
ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes \
"$TARGET_USER@$TARGET_HOST" \
"sudo install -d -m 755 /aisystant/app/static"
- name: Deploy with rsync
env:
TARGET_USER: ${{ secrets.VKCS_USER_DOCS_VM }}
TARGET_HOST: ${{ secrets.VKCS_SSH_IP_DOCS_VM }}
run: |
rsync -avz \
--delete \
--checksum \
--rsync-path="sudo rsync" \
-e "ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes" \
.vitepress/dist/ \
"$TARGET_USER@$TARGET_HOST:/aisystant/app/static/"
- name: Fix SELinux context for static files
env:
TARGET_USER: ${{ secrets.VKCS_USER_DOCS_VM }}
TARGET_HOST: ${{ secrets.VKCS_SSH_IP_DOCS_VM }}
run: |
ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes \
"$TARGET_USER@$TARGET_HOST" \
"if command -v semanage >/dev/null 2>&1; then \
sudo semanage fcontext -a -t httpd_sys_content_t '/aisystant/app/static(/.*)?' || \
sudo semanage fcontext -m -t httpd_sys_content_t '/aisystant/app/static(/.*)?'; \
sudo restorecon -RF /aisystant/app/static; \
else \
sudo chcon -R -t httpd_sys_content_t /aisystant/app/static; \
fi"
- name: Verify and reload nginx
env:
TARGET_USER: ${{ secrets.VKCS_USER_DOCS_VM }}
TARGET_HOST: ${{ secrets.VKCS_SSH_IP_DOCS_VM }}
run: |
ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes \
"$TARGET_USER@$TARGET_HOST" \
"sudo nginx -t && sudo systemctl reload nginx && \
ls -la /aisystant/app/static/ | head -5"