2023-12-19 20:04:51 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
2023-12-19 20:03:28 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
checking:
|
|
|
|
runs-on: docker
|
2023-12-19 20:35:16 +00:00
|
|
|
container: node:lts
|
2023-12-19 20:03:28 +00:00
|
|
|
steps:
|
2023-12-19 20:57:13 +00:00
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v3
|
2023-12-19 20:03:28 +00:00
|
|
|
- name:
|
|
|
|
run: npm install
|
|
|
|
- name: Astro checks
|
|
|
|
run: npm run astro check
|
|
|
|
|
|
|
|
build-site:
|
|
|
|
needs: [checking]
|
|
|
|
runs-on: docker
|
2023-12-19 20:35:16 +00:00
|
|
|
container: node:lts
|
2023-12-19 20:03:28 +00:00
|
|
|
steps:
|
2023-12-19 20:57:13 +00:00
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v3
|
2023-12-19 21:30:02 +00:00
|
|
|
- run: npm install
|
2023-12-19 20:03:28 +00:00
|
|
|
- name: Build static site
|
|
|
|
run: npm run build
|
|
|
|
- name: Delete unnecessary data files
|
|
|
|
run: rm -r public/assets/data/
|
|
|
|
- name: Add missing config for binserve
|
|
|
|
run: cp serve.json public
|
2023-12-19 21:04:55 +00:00
|
|
|
- uses: https://code.forgejo.org/actions/upload-artifact@v3
|
2023-12-19 20:03:28 +00:00
|
|
|
with:
|
|
|
|
name: static-site
|
|
|
|
path: public/
|
|
|
|
|
|
|
|
deploy-site:
|
|
|
|
needs: [build-site]
|
|
|
|
runs-on: docker
|
|
|
|
env:
|
|
|
|
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
|
|
|
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
|
|
|
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
|
|
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
|
|
steps:
|
2023-12-19 21:30:02 +00:00
|
|
|
- uses: https://code.forgejo.org/actions/checkout@v3
|
2023-12-19 21:04:55 +00:00
|
|
|
- uses: actions/download-artifact@v3
|
2023-12-19 20:03:28 +00:00
|
|
|
with:
|
|
|
|
name: static-site
|
2023-12-19 21:24:44 +00:00
|
|
|
- id: ssh-setup
|
|
|
|
uses: ./.forgejo/local-action
|
2023-12-19 20:03:28 +00:00
|
|
|
with:
|
|
|
|
DEPLOY_HOST: $DEPLOY_HOST
|
|
|
|
SSH_KNOWN_HOSTS: $SSH_KNOWN_HOSTS
|
|
|
|
SSH_PRIVATE_KEY: $SSH_PRIVATE_KEY
|
|
|
|
- name: Stopping screen session, cleaning
|
|
|
|
run: ssh $DEPLOY_USER@$DEPLOY_HOST "screen -X -S fgo-ta_com-public kill; rm -r -f fgo-ta_com/public/*;"
|
|
|
|
- name: Copying to proxmox machine
|
2023-12-19 21:11:58 +00:00
|
|
|
run: rsync -az --stats static-site/* $DEPLOY_USER@$DEPLOY_HOST:~/fgo-ta_com/public
|
2023-12-19 20:03:28 +00:00
|
|
|
- name: Restarting screen session
|
|
|
|
run: ssh $DEPLOY_USER@$DEPLOY_HOST 'PATH="$HOME/.local/bin:$PATH"; cd fgo-ta_com; find public -maxdepth 1 -printf "%p\n"; screen -S fgo-ta_com-public -dm serve public/ -p 9200'
|