👷 update CI build to use server instead of GitHub Pages
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
parent
1922985aeb
commit
2aa20ca388
1 changed files with 24 additions and 27 deletions
51
.github/workflows/deploy.yml
vendored
51
.github/workflows/deploy.yml
vendored
|
@ -1,8 +1,6 @@
|
|||
name: Deploy to GitHub Pages
|
||||
name: Deploy website
|
||||
|
||||
on:
|
||||
# Trigger the workflow every time you push to the `main` branch
|
||||
# Using a different branch name? Replace `main` with your branch’s name
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
|
@ -10,32 +8,31 @@ on:
|
|||
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
||||
workflow_dispatch:
|
||||
|
||||
# Allow this job to clone the repo and create a page deployment
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout your repository using git
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Install, build, and upload your site
|
||||
uses: withastro/action@v1
|
||||
# with:
|
||||
# path: . # The root location of your Astro project inside the repository. (optional)
|
||||
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
|
||||
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v1
|
||||
- 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
|
||||
|
|
Loading…
Reference in a new issue