fix(pages): 使用站内 /assets 引用图片,而非相对文件路径 #260
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |