2024-03-17 10:24:06 +00:00
|
|
|
name: Deploy website
|
2023-12-10 00:41:39 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2023-12-10 01:01:37 +00:00
|
|
|
branches: [ main ]
|
2024-02-04 12:22:33 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md' # Ignore changes to README.md
|
2023-12-10 00:41:39 +00:00
|
|
|
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
2024-03-17 10:24:06 +00:00
|
|
|
build-and-deploy:
|
2023-12-10 00:41:39 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-03-17 10:24:06 +00:00
|
|
|
- name: Checkout repository
|
2023-12-10 00:41:39 +00:00
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2024-03-17 10:24:06 +00:00
|
|
|
- name: Setup Node.js
|
|
|
|
uses: actions/setup-node@v3
|
|
|
|
with:
|
|
|
|
node-version: '21'
|
|
|
|
cache: 'yarn'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install
|
|
|
|
|
|
|
|
- name: Build Astro website
|
|
|
|
run: yarn build
|
|
|
|
|
|
|
|
- name: Deploy and Reload Caddy
|
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ secrets.HOST }}
|
|
|
|
username: ${{ secrets.USER }}
|
|
|
|
key: ${{ secrets.KEY }}
|
|
|
|
script: |
|
|
|
|
rsync -avzr --delete $GITHUB_WORKSPACE/dist/ ${{ secrets.USER }}@${{ secrets.HOST }}:/var/www/kjelsrud.dev/
|
|
|
|
sudo systemctl reload caddy
|