2024-08-27 23:14:20 +00:00
|
|
|
name: Astro Deploy Pipeline
|
|
|
|
run-name: Builds the Astro site and Deploys via SSH to the Server
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Build-and-Deploy:
|
|
|
|
steps:
|
2024-08-27 23:24:07 +00:00
|
|
|
- name: Install Git LFS and Rsync
|
2024-08-27 23:25:06 +00:00
|
|
|
run: apt-get update && apt-get install -y git-lfs rsync
|
2024-08-27 23:22:28 +00:00
|
|
|
|
2024-08-27 23:14:20 +00:00
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
lfs: true
|
|
|
|
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
|
|
|
|
|
|
|
|
- name: Checkout LFS objects
|
|
|
|
run: git lfs checkout
|
|
|
|
|
|
|
|
- name: Setup Node
|
|
|
|
uses: actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
|
2024-08-27 23:26:00 +00:00
|
|
|
- name: Install node modules
|
|
|
|
run: npm i
|
|
|
|
|
2024-08-27 23:14:20 +00:00
|
|
|
- name: Build site
|
|
|
|
run: npm run build
|
|
|
|
|
|
|
|
- name: Install SSH Key
|
2024-08-27 23:20:49 +00:00
|
|
|
uses: https://github.com/shimataro/ssh-key-action@v2
|
2024-08-27 23:14:20 +00:00
|
|
|
with:
|
|
|
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
known_hosts: 'placeholder' # to make it work
|
|
|
|
|
|
|
|
- name: Adding Known Hosts
|
|
|
|
run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
|
|
|
|
|
|
|
|
- name: Deploy with rsync
|
2024-08-27 23:29:52 +00:00
|
|
|
run: rsync -avz --delete ./dist/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_TARGET }} --rsync-path=/usr/bin/rsync
|