Commit 91526e966a
Unregistered key
Layout: unified · split
.github/workflows/deploy.yml deleted −69
| @@ -1,69 +0,0 @@ | |||
| 1 | # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
| 2 | name: Deploy Docs | ||
| 3 | |||
| 4 | on: | ||
| 5 | push: | ||
| 6 | branches: [main] | ||
| 7 | workflow_dispatch: | ||
| 8 | |||
| 9 | jobs: | ||
| 10 | build-and-deploy: | ||
| 11 | runs-on: ubuntu-22.04 | ||
| 12 | strategy: | ||
| 13 | matrix: | ||
| 14 | node-version: [20] | ||
| 15 | steps: | ||
| 16 | - name: Checkout repository | ||
| 17 | uses: actions/checkout@v4 | ||
| 18 | with: | ||
| 19 | fetch-depth: 0 | ||
| 20 | |||
| 21 | - name: Install pnpm | ||
| 22 | uses: pnpm/action-setup@v4 | ||
| 23 | |||
| 24 | - name: Use Node.js ${{ matrix.node-version }} | ||
| 25 | uses: actions/setup-node@v4 | ||
| 26 | with: | ||
| 27 | node-version: ${{ matrix.node-version }} | ||
| 28 | cache: "pnpm" | ||
| 29 | |||
| 30 | - name: Install dependencies | ||
| 31 | run: pnpm install --frozen-lockfile | ||
| 32 | |||
| 33 | # - name: Cache Vitepress | ||
| 34 | # uses: actions/cache@v4 | ||
| 35 | # with: | ||
| 36 | # path: docs/.vitepress/cache | ||
| 37 | # key: | ||
| 38 | # ${{ runner.os }}-vitepress-${{ hashFiles('docs/.vitepress/cache/**','pnpm-lock.yaml') }} | ||
| 39 | # restore-keys: ${{ runner.os }}-vitepress- | ||
| 40 | |||
| 41 | - name: Build docs | ||
| 42 | run: pnpm docs:build | ||
| 43 | |||
| 44 | - name: Deploy to server | ||
| 45 | env: | ||
| 46 | SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| 47 | SSH_HOST: ${{ secrets.SSH_HOST }} | ||
| 48 | WORK_DIR: ${{ secrets.WORK_DIR }} | ||
| 49 | SSH_USER: ${{ secrets.SSH_USER }} | ||
| 50 | run: | | ||
| 51 | install -m 600 -D /dev/null ~/.ssh/id_rsa | ||
| 52 | echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | ||
| 53 | ssh-keyscan -H $SSH_HOST >> ~/.ssh/known_hosts | ||
| 54 | echo "Installed SSH key" | ||
| 55 | rsync -ravh --update --delete docs/.vitepress/dist/* $SSH_USER@$SSH_HOST:/home/wotaku/htdocs/wotaku.moe/ | ||
| 56 | rm -f ~/.ssh/id_rsa | ||
| 57 | |||
| 58 | - name: Purge Cloudflare Cache | ||
| 59 | env: | ||
| 60 | CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }} | ||
| 61 | CF_ACCOUNT_MAIL: ${{ secrets.CF_ACCOUNT_MAIL }} | ||
| 62 | CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }} | ||
| 63 | run: | | ||
| 64 | curl --request POST \ | ||
| 65 | --url https://api.cloudflare.com/client/v4/zones/${{ secrets.cf_zone_id }}/purge_cache \ | ||
| 66 | --header 'Content-Type: application/json' \ | ||
| 67 | --header 'X-Auth-Email: ${{ secrets.cf_account_mail }}' \ | ||
| 68 | --header 'Authorization: Bearer ${{ secrets.cf_api_token }}' \ | ||
| 69 | --data '{"purge_everything": true}' | ||