Skip to content

Commit 03404df

Browse files
committed
chore: update workflow for nuxt
1 parent 2d4c87e commit 03404df

File tree

2 files changed

+31
-49
lines changed

2 files changed

+31
-49
lines changed

.github/workflows/deploy.yaml

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,61 +4,43 @@ on:
44
push:
55
branches:
66
- master # default branch
7+
- chore-nuxt-deploy # Test only
78

89
jobs:
910
build:
1011
runs-on: ubuntu-latest
11-
permissions:
12-
contents: write
1312
steps:
14-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v5
1514
- name: Use Node.js 22
16-
uses: actions/setup-node@v4
15+
uses: actions/setup-node@v5
1716
with:
1817
node-version: '22'
19-
- name: Cache NPM dependencies
20-
uses: actions/cache@v4
18+
19+
# https://github.com/actions/cache/blob/v4/examples.md#node---npm
20+
- name: Get npm cache directory
21+
id: npm-cache-dir
22+
shell: bash
23+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
24+
- uses: actions/cache@v4
25+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
2126
with:
22-
path: node_modules
23-
key: ${{ runner.OS }}-npm-cache
27+
path: ${{ steps.npm-cache-dir.outputs.dir }}
28+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
2429
restore-keys: |
25-
${{ runner.OS }}-npm-cache
26-
- name: Setup SSH Private Key
27-
env:
28-
KEY: ${{ secrets.KEY }}
29-
IP: ${{ secrets.IP }}
30-
run: |
31-
mkdir -p ~/.ssh/
32-
echo "$KEY" > ~/.ssh/id_rsa
33-
chmod 600 ~/.ssh/id_rsa
34-
ssh-keyscan $IP >> ~/.ssh/known_hosts
35-
- name: Install deps
36-
run: |
37-
sudo apt install expect tcl-expect -y
38-
- name: Upload website
39-
env:
40-
IP: ${{ secrets.IP }}
41-
run: |
42-
rm -rf website*
43-
44-
# Build utilities
45-
git submodule update --init
46-
pushd utils/make-news-index
47-
go build -o make-news-index
48-
popd
30+
${{ runner.os }}-node-
4931
50-
# Build news index
51-
pushd public
52-
../utils/make-news-index/make-news-index
53-
popd
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build
36+
run: npm run generate
5437

55-
# Build website
56-
npm i
57-
npm run build
58-
59-
zip -r website.zip website/
60-
scp website.zip aosc@$IP:/home/aosc/web/
61-
- name: Unzip website
62-
run: |
63-
cd deploy
64-
./unzipServer.sh
38+
- name: Copy files via SSH
39+
uses: appleboy/scp-action@v1
40+
with:
41+
host: ${{ secrets.IP }}
42+
username: aosc
43+
key: ${{ secrets.KEY }}
44+
source: ".output/public"
45+
target: /home/aosc/web/website-nuxt #Test bnly
46+
rm: true

nuxt.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default defineNuxtConfig({
7070

7171
compatibilityDate: '2025-06-22',
7272

73-
runtimeConfig:{
73+
runtimeConfig: {
7474
public: {
7575
pasteApi: process.env.PASTE_API || 'https://paste.aosc.io'
7676
}
@@ -104,10 +104,10 @@ export default defineNuxtConfig({
104104
}
105105
}
106106
},
107-
107+
108108
nitro: {
109109
prerender: {
110-
ignore: ["/paste/detail"],
110+
ignore: ['/paste/detail']
111111
}
112112
},
113113

0 commit comments

Comments
 (0)