Skip to content

Merge branch 'main' of https://github.com/Lyricify/Lyricify-Docs #54

Merge branch 'main' of https://github.com/Lyricify/Lyricify-Docs

Merge branch 'main' of https://github.com/Lyricify/Lyricify-Docs #54

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
- name: Restore translation cache
id: translation-cache-restore
uses: actions/cache/restore@v4
with:
path: .cache/ci-translations
key: translation-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/deploy.yml', '.github/scripts/generate-ci-translations.mjs') }}-${{ github.sha }}
restore-keys: |
translation-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/deploy.yml', '.github/scripts/generate-ci-translations.mjs') }}-
- name: Install dependencies
run: npm ci
- name: Generate incremental translation docs for CI
run: node ./.github/scripts/generate-ci-translations.mjs
env:
TRANSLATION_API_KEY: ${{ secrets.TRANSLATION_API_KEY }}
TRANSLATION_MODEL: ${{ vars.TRANSLATION_MODEL }}
TRANSLATION_BASE_URL: ${{ vars.TRANSLATION_BASE_URL }}
- name: Build site
run: npm run build
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
- name: Upload dist for server deploy
uses: actions/upload-artifact@v4
with:
name: site-dist
path: ./dist
- name: Save translation cache
uses: actions/cache/save@v4
with:
path: .cache/ci-translations
key: translation-cache-${{ runner.os }}-${{ hashFiles('.github/workflows/deploy.yml', '.github/scripts/generate-ci-translations.mjs') }}-${{ github.sha }}
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
deploy_server:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download built site
uses: actions/download-artifact@v4
with:
name: site-dist
path: ./dist
- name: Setup SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DOCS_SERVER_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -p ${{ secrets.DOCS_SERVER_PORT }} ${{ secrets.DOCS_SERVER_HOST }} >> ~/.ssh/known_hosts
- name: Sync dist to server
run: |
rsync -avz --delete -e "ssh -p ${{ secrets.DOCS_SERVER_PORT }}" ./dist/ \
${{ secrets.DOCS_SERVER_USER }}@${{ secrets.DOCS_SERVER_HOST }}:${{ secrets.DOCS_SERVER_PATH }}/