Deploy To SFTP #66
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 To SFTP | |
on: | |
schedule: | |
- cron: "0 */12 * * *" | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: latest | |
- name: Install NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
cache: "pnpm" | |
- name: Install Dependencies | |
run: pnpm i | |
- name: Make envfile | |
uses: SpicyPizza/[email protected] | |
with: | |
envkey_NASA_API: ${{ secrets.NASA_API }} | |
- name: Build Astro Website | |
run: pnpm build | |
- name: SFTP Deploy | |
uses: SamKirkland/[email protected] | |
with: | |
server: ${{ secrets.FTP_HOST }} | |
username: ${{ secrets.FTP_LOGIN }} | |
password: ${{ secrets.FTP_PASSWD }} | |
port: 21 | |
local-dir: 'dist/' | |
server-dir: "/" | |
- name: Clear Cloudflare cache | |
env: | |
ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} | |
API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
run: | | |
curl -X POST "https://api.cloudflare.com/client/v4/zones/${ZONE_ID}/purge_cache" \ | |
-H "Authorization: Bearer ${API_TOKEN}" \ | |
-H "Content-Type: application/json" \ | |
--data '{"purge_everything":true}' |