2023-07-09 13:29:05 +08:00
|
|
|
name: 🚀 Build and deploy by ftp
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-07-09 13:33:17 +08:00
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- main
|
2023-07-09 13:29:05 +08:00
|
|
|
jobs:
|
|
|
|
|
|
|
|
ftp-build-and-deploy:
|
|
|
|
name: 🎉 Deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: 🚚 Get latest code
|
2023-07-09 13:43:12 +08:00
|
|
|
uses: https://github.com/actions/checkout@v3
|
2023-07-09 13:29:05 +08:00
|
|
|
|
2023-07-09 13:43:12 +08:00
|
|
|
- uses: https://github.com/actions/setup-node@v3
|
2023-07-09 13:29:05 +08:00
|
|
|
with:
|
2023-07-09 13:33:17 +08:00
|
|
|
node-version: 16
|
2023-07-09 13:29:05 +08:00
|
|
|
|
2023-07-09 14:24:36 +08:00
|
|
|
- uses: https://github.com/pnpm/action-setup@v2
|
|
|
|
name: Install pnpm
|
|
|
|
id: pnpm-install
|
|
|
|
with:
|
|
|
|
version: 7
|
|
|
|
run_install: false
|
|
|
|
|
|
|
|
- name: Get pnpm store directory
|
|
|
|
id: pnpm-cache
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
|
|
|
|
2023-07-09 17:28:04 +08:00
|
|
|
- uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version: '1.20'
|
|
|
|
|
|
|
|
- uses: actions/go-hashfiles@v0.0.1
|
|
|
|
id: get-hash
|
|
|
|
with:
|
|
|
|
patterns: |-
|
|
|
|
go.sum
|
|
|
|
**/pnpm-lock.yaml
|
|
|
|
|
2023-07-09 16:54:13 +08:00
|
|
|
- uses: https://github.com/actions/cache@v3
|
2023-07-09 14:24:36 +08:00
|
|
|
name: Setup pnpm cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
2023-07-09 17:28:04 +08:00
|
|
|
key: ${{ runner.os }}-pnpm-store-${{ steps.get-hash.outputs.hash }}
|
2023-07-09 14:24:36 +08:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pnpm-store-
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: pnpm install
|
|
|
|
|
2023-07-09 13:29:05 +08:00
|
|
|
- run: pnpm build
|
|
|
|
- run: npm run export
|
|
|
|
|
|
|
|
- name: 📂 Sync files
|
2023-07-09 13:43:12 +08:00
|
|
|
uses: https://github.com/SamKirkland/FTP-Deploy-Action@v4.3.4
|
2023-07-09 13:29:05 +08:00
|
|
|
with:
|
|
|
|
server: ${{ secrets.ftp_server }}
|
|
|
|
username: ${{ secrets.ftp_username }}
|
|
|
|
password: ${{ secrets.ftp_password }}
|