👷 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:
|
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:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
|
@ -10,32 +8,31 @@ on:
|
||||||
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Allow this job to clone the repo and create a page deployment
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout your repository using git
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
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:
|
- name: Setup Node.js
|
||||||
needs: build
|
uses: actions/setup-node@v3
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
environment:
|
node-version: '21'
|
||||||
name: github-pages
|
cache: 'yarn'
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
|
||||||
steps:
|
- name: Install dependencies
|
||||||
- name: Deploy to GitHub Pages
|
run: yarn install
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v1
|
- 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…
Add table
Reference in a new issue