Manual redeploy + port
This commit is contained in:
parent
b82163f5f6
commit
24414a8a4f
2 changed files with 50 additions and 14 deletions
|
@ -8,10 +8,11 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container: node:lts
|
container: node:lts
|
||||||
steps:
|
steps:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v3
|
- name: Checkout source code
|
||||||
- name:
|
uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
|
- name: Install packages
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Astro checks
|
- name: Run astro check (linting + static analysis)
|
||||||
run: npm run astro check
|
run: npm run astro check
|
||||||
|
|
||||||
build-site:
|
build-site:
|
||||||
|
@ -19,15 +20,18 @@ jobs:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container: node:lts
|
container: node:lts
|
||||||
steps:
|
steps:
|
||||||
- uses: https://code.forgejo.org/actions/checkout@v3
|
- name: Checkout checked source code
|
||||||
- run: npm install
|
uses: https://code.forgejo.org/actions/checkout@v3
|
||||||
|
- name: Install required packages
|
||||||
|
run: npm install
|
||||||
- name: Build static site
|
- name: Build static site
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Delete unnecessary data files
|
- name: Delete unnecessary data files
|
||||||
run: rm -r public/assets/data/
|
run: rm -r public/assets/data/
|
||||||
- name: Add missing config for binserve
|
- name: Copy missing config for binserve
|
||||||
run: cp serve.json public
|
run: cp serve.json public
|
||||||
- uses: https://code.forgejo.org/actions/upload-artifact@v3
|
- name: Save site artifact as static-site
|
||||||
|
uses: https://code.forgejo.org/actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: static-site
|
name: static-site
|
||||||
path: public/
|
path: public/
|
||||||
|
@ -43,11 +47,11 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
which rsync || ( apt update -y && apt install rsync -y)
|
which rsync || ( apt update -y && apt install rsync -y)
|
||||||
which ssh-agent || ( apt update -y && apt install openssh-client -y)
|
which ssh-agent || ( apt update -y && apt install openssh-client -y)
|
||||||
- uses: actions/download-artifact@v3
|
- name: Downloading static site artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: static-site
|
name: static-site
|
||||||
path: public
|
path: public
|
||||||
- run: ls -R
|
|
||||||
- name: Install SSH Key
|
- name: Install SSH Key
|
||||||
uses: https://github.com/shimataro/ssh-key-action@v2
|
uses: https://github.com/shimataro/ssh-key-action@v2
|
||||||
with:
|
with:
|
||||||
|
@ -55,7 +59,7 @@ jobs:
|
||||||
known_hosts: unnecessary
|
known_hosts: unnecessary
|
||||||
- name: Adding Known Hosts
|
- name: Adding Known Hosts
|
||||||
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
run: ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
|
||||||
- name: stop + cleanup
|
- name: Stop screen session, delete old files
|
||||||
uses: https://github.com/appleboy/ssh-action@master
|
uses: https://github.com/appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ env.DEPLOY_HOST }}
|
host: ${{ env.DEPLOY_HOST }}
|
||||||
|
@ -64,9 +68,9 @@ jobs:
|
||||||
script: |
|
script: |
|
||||||
screen -X -S fgo-ta_com-public kill
|
screen -X -S fgo-ta_com-public kill
|
||||||
rm -r -f fgo-ta_com/public/*
|
rm -r -f fgo-ta_com/public/*
|
||||||
- name: copy using rsync
|
- name: Copy files using rsync
|
||||||
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/fgo-ta_com/public
|
run: rsync -az --stats public/* ${{ env.DEPLOY_USER }}@${{ env.DEPLOY_HOST }}:~/fgo-ta_com/public
|
||||||
- name: start
|
- name: Start new screen session
|
||||||
uses: https://github.com/appleboy/ssh-action@master
|
uses: https://github.com/appleboy/ssh-action@master
|
||||||
with:
|
with:
|
||||||
host: ${{ env.DEPLOY_HOST }}
|
host: ${{ env.DEPLOY_HOST }}
|
||||||
|
@ -76,4 +80,4 @@ jobs:
|
||||||
PATH="$HOME/.local/bin:$PATH"
|
PATH="$HOME/.local/bin:$PATH"
|
||||||
cd fgo-ta_com
|
cd fgo-ta_com
|
||||||
find public -maxdepth 1 -printf "%p\n"
|
find public -maxdepth 1 -printf "%p\n"
|
||||||
screen -S fgo-ta_com-public -dm serve public/ -p 9200
|
screen -S fgo-ta_com-public -dm serve public/ -p ${{ secrets.DEPLOY_TARGET_PORT }}
|
||||||
|
|
32
.forgejo/workflows/redeploy.yml
Normal file
32
.forgejo/workflows/redeploy.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
redeploy-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)
|
||||||
|
- 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: Restart screen session
|
||||||
|
uses: https://github.com/appleboy/ssh-action@master
|
||||||
|
with:
|
||||||
|
host: ${{ env.DEPLOY_HOST }}
|
||||||
|
username: ${{ env.DEPLOY_USER }}
|
||||||
|
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
script: |
|
||||||
|
screen -X -S fgo-ta_com-public kill
|
||||||
|
PATH="$HOME/.local/bin:$PATH"
|
||||||
|
cd fgo-ta_com
|
||||||
|
screen -S fgo-ta_com-public -dm serve public/ -p ${{ secrets.DEPLOY_TARGET_PORT }}
|
Loading…
Reference in a new issue