fgo-ta-com-website/.forgejo/workflows/ci.yml
Firq c348b10fa2
Some checks failed
/ checking (push) Successful in 16s
/ build-site (push) Successful in 18s
/ deploy-site (push) Failing after 7s
fixing var
2023-12-19 22:56:23 +01:00

78 lines
2.3 KiB
YAML

on:
push:
branches:
- main
jobs:
checking:
runs-on: docker
container: node:lts
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- name:
run: npm install
- name: Astro checks
run: npm run astro check
build-site:
needs: [checking]
runs-on: docker
container: node:lts
steps:
- uses: https://code.forgejo.org/actions/checkout@v3
- run: npm install
- 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
- uses: https://code.forgejo.org/actions/upload-artifact@v3
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 }}
steps:
- name: Install and update ssh + rsync
run: |
which rsync || ( apt update -y && apt install rsync -y)
which ssh-agent || ( apt update -y && apt install openssh-client -y)
- uses: actions/download-artifact@v3
with:
name: static-site
- name: Install SSH Key
uses: https://github.com/shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: unnecessary
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: stop + cleanup
uses: https://github.com/appleboy/ssh-action@master
with:
host: DEPLOY_HOST
username: DEPLOY_USER
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
screen -X -S fgo-ta_com-public kill
rm -r -f fgo-ta_com/public/*
- name: copy using rsync
run: rsync -az --stats static-site/* $DEPLOY_USER@$DEPLOY_HOST:~/fgo-ta_com/public
- name: start
uses: https://github.com/appleboy/ssh-action@master
with:
host: DEPLOY_HOST
username: DEPLOY_USER
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
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