added sitemap generation #15
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: Deploy | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm ci | |
- name: Generating the site | |
run: npm run docs:build | |
- name: Cleaning up the site directory before deployment | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_SERVER_IP }} | |
port: ${{ secrets.SSH_SERVER_PORT }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd ${{ secrets.SITE_DIR }} | |
rm -rf * | |
- name: Deploying the site | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.SSH_SERVER_IP }} | |
REMOTE_USER: ${{ secrets.SSH_USER }} | |
REMOTE_PORT: ${{ secrets.SSH_SERVER_PORT }} | |
SOURCE: "docs/.vitepress/dist/" | |
TARGET: ${{ secrets.SITE_DIR }} | |
- name: Clearing the Cloudflare cache | |
uses: jakejarvis/cloudflare-purge-action@master | |
env: | |
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} | |
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} |