61 lines
1.8 KiB
YAML
61 lines
1.8 KiB
YAML
name: Build and Deploy
|
|
run-name: Build And Deploy (by ${{ gitea.actor }}) 🚀
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Build and Upload
|
|
steps:
|
|
- name: Checkout Source Code
|
|
uses: actions/checkout@v4
|
|
- name: Install yarn
|
|
shell: bash
|
|
run: npm i yarn -g
|
|
- name: Yarn install (dev)
|
|
shell: bash
|
|
run: yarn install
|
|
- name: Vite build
|
|
shell: bash
|
|
run: ./node_modules/.bin/vite build
|
|
- name: Publish artifacts
|
|
uses: https://gitea.com/actions/gitea-upload-artifact@v4
|
|
with:
|
|
name: artifact
|
|
path: |
|
|
dist
|
|
index.html
|
|
package.json
|
|
public
|
|
src
|
|
tsconfig.json
|
|
vite.config.ts
|
|
yarn.lock
|
|
Upload:
|
|
steps:
|
|
- name: Download artifacts
|
|
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
|
with:
|
|
name: artifact
|
|
path: artifact
|
|
- name: Install rsync
|
|
run: |
|
|
apt-get update
|
|
apt-get -y install rsync
|
|
- name: Upload and install dependencies in server
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
chmod 600 ~/.ssh
|
|
echo "$SSH_KEYSCAN" > ~/.ssh/known_hosts
|
|
chmod 600 ~/.ssh/known_hosts
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
|
|
chmod 600 ~/.ssh/id_ed25519
|
|
# scp -r -P 44 artifact owofannouncements@foxthesystem.space:~/server
|
|
rsync -avzxh --delete -e 'ssh -p 44' artifact owofannouncements@foxthesystem.space:~/server
|
|
ssh -p 44 owofannouncements@foxthesystem.space "/bin/bash -c 'cd server ; yarn install --production=true'"
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
SSH_KEYSCAN: ${{ secrets.SSH_KEYSCAN }} |