Skip to content

chore(workflows): 适配独立 utils 仓库 #258

chore(workflows): 适配独立 utils 仓库

chore(workflows): 适配独立 utils 仓库 #258

Workflow file for this run

name: Deploy
on:
push:
branches:
- master # default branch
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Cache NPM dependencies
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Setup SSH Private Key
env:
KEY: ${{ secrets.KEY }}
IP: ${{ secrets.IP }}
run: |
mkdir -p ~/.ssh/
echo "$KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan $IP >> ~/.ssh/known_hosts
- name: Install deps
run: |
sudo apt install expect tcl-expect -y
- name: Upload website
env:
IP: ${{ secrets.IP }}
run: |
rm -rf website*
# Build website
npm i
npm run build
# Build utilities
git submodule update --init
pushd utils/make-news-index
go build -o make-news-index
popd
# Build news index
pushd public
../utils/make-news-index/make-news-index
popd
zip -r website.zip website/
scp website.zip aosc@$IP:/home/aosc/web/
- name: Unzip website
run: |
cd deploy
./unzipServer.sh