💚 Update workflow for forgejo instance
Some checks are pending
Deploy website / build-and-deploy (push) Waiting to run
Some checks are pending
Deploy website / build-and-deploy (push) Waiting to run
Signed-off-by: SindreKjelsrud <sindre@kjelsrud.dev>
This commit is contained in:
parent
2c0141b609
commit
10e690aa95
4 changed files with 57 additions and 41 deletions
31
.forgejo/workflows/deploy.yml
Normal file
31
.forgejo/workflows/deploy.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
name: Deploy website
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'README.md' # Ignore changes to README.md
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up SSH
|
||||
uses: webfactory/ssh-agent@v0.5.3
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Add remote host to known_hosts
|
||||
run: ssh-keyscan drumisland >> ~/.ssh/known_hosts
|
||||
|
||||
|
||||
- name: Sync files with rsync to remote server
|
||||
run: |
|
||||
rsync -avz --exclude='.git' --exclude='.github' --exclude='README.md' ./ user@drumisland:kjelsrud.dev/
|
||||
|
||||
- name: Run docker-compose on remote server
|
||||
run: ssh -o StrictHostKeyChecking=no sid@drumisland "kjelsrud.dev && docker-compose up -d --build"
|
||||
|
41
.github/workflows/deploy.yml
vendored
41
.github/workflows/deploy.yml
vendored
|
@ -1,41 +0,0 @@
|
|||
name: Deploy website
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
paths-ignore:
|
||||
- 'README.md' # Ignore changes to README.md
|
||||
# Allows you to run this workflow manually from the Actions tab on GitHub.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '21'
|
||||
|
||||
- name: Install pnpm
|
||||
run: npm install -g @pnpm/exe
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Build Astro website
|
||||
run: pnpm build
|
||||
|
||||
- name: Rsync files
|
||||
uses: burnett01/rsync-deployments@5.2
|
||||
with:
|
||||
switches: -avzr --delete
|
||||
path: dist/
|
||||
remote_path: /var/www/kjelsrud.dev/
|
||||
remote_host: ${{ secrets.HOST }}
|
||||
remote_user: ${{ secrets.USER }}
|
||||
remote_key: ${{ secrets.KEY }}
|
||||
remote_port: ${{ secrets.PORT }}
|
18
Dockerfile
Normal file
18
Dockerfile
Normal file
|
@ -0,0 +1,18 @@
|
|||
FROM node:lts-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN npm install -g pnpm
|
||||
|
||||
COPY . /app
|
||||
|
||||
RUN pnpm install
|
||||
RUN pnpm run build
|
||||
|
||||
FROM caddy:alpine
|
||||
|
||||
COPY --from=build /app/dist /usr/share/caddy
|
||||
|
||||
EXPOSE 4321
|
||||
|
||||
CMD ["caddy", "file-server", "--root", "/usr/share/caddy", "--listen", ":4321"]
|
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
services:
|
||||
web:
|
||||
restart: always
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "4321:4321"
|
Loading…
Reference in a new issue