Replace Discord icons #336
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Deploy Docs | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "pnpm" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
# - name: Cache Vitepress | |
# uses: actions/cache@v4 | |
# with: | |
# path: docs/.vitepress/cache | |
# key: | |
# ${{ runner.os }}-vitepress-${{ hashFiles('docs/.vitepress/cache/**','pnpm-lock.yaml') }} | |
# restore-keys: ${{ runner.os }}-vitepress- | |
- name: Build docs | |
run: pnpm docs:build | |
- name: Deploy to server | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
WORK_DIR: ${{ secrets.WORK_DIR }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
run: | | |
install -m 600 -D /dev/null ~/.ssh/id_rsa | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | |
ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts | |
echo "Installed SSH key" | |
rsync -ravh --update --delete docs/.vitepress/dist/* $SSH_USER@$SSH_HOST:/home/wotaku/htdocs/wotaku.moe/ | |
rm -f ~/.ssh/id_rsa | |
- name: Purge Cloudflare Cache | |
env: | |
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }} | |
CF_ACCOUNT_MAIL: ${{ secrets.CF_ACCOUNT_MAIL }} | |
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | |
run: | | |
curl --request POST \ | |
--url https://api.cloudflare.com/client/v4/zones/${{ secrets.cf_zone_id }}/purge_cache \ | |
--header 'Content-Type: application/json' \ | |
--header 'X-Auth-Email: ${{ secrets.cf_account_mail }}' \ | |
--header 'Authorization: Bearer ${{ secrets.cf_api_token }}' \ | |
--data '{"purge_everything": true}' |