Repository navigation
144 lines (140 loc) 路 4.71 KB
/
Copy pathdeploy.yml
File metadata and controls
144 lines (140 loc) 路 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Deploy documentation
on:
push:
branches:
- develop
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- name: Set up pnpm and Node.js
uses: pnpm/setup@v3.1.1
with:
working-directory: docs
runtime: node@26
cache: true
require-lockfile: true
- name: Build
run: pnpm build
- name: Deploy to SFTP
if: github.ref == 'refs/heads/develop'
env:
SFTP_HOST: ${{ secrets.SFTP_HOST }}
SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }}
SFTP_KEY: ${{ secrets.SFTP_KEY }}
SFTP_KNOWN_HOSTS: ${{secrets.SFTP_KNOWN_HOSTS}}
run: |
echo "$SFTP_KEY" > sftp_key
chmod 600 sftp_key
echo "$SFTP_KNOWN_HOSTS" > known_hosts
chmod 600 known_hosts
rsync -avz --delete -e "ssh -i sftp_key -o UserKnownHostsFile=known_hosts" dist/ $SFTP_USERNAME@$SFTP_HOST:/var/www/www.setonix
build-doc-api:
runs-on: ubuntu-26.04
timeout-minutes: 30
defaults:
run:
working-directory: server
steps:
- name: 猬嗭笍 Checkout
uses: actions/checkout@v7
- uses: subosito/flutter-action@v2.23.0
with:
flutter-version-file: app/pubspec.yaml
cache: true
- name: Install dependencies
run: flutter pub get
- name: Generate documentation
run: dart doc
- name: Deploy API docs via SFTP
if: github.ref == 'refs/heads/develop'
env:
SFTP_HOST: ${{ secrets.SFTP_HOST }}
SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }}
SFTP_KEY: ${{ secrets.SFTP_KEY }}
SFTP_KNOWN_HOSTS: ${{secrets.SFTP_KNOWN_HOSTS}}
run: |
echo "$SFTP_KEY" > sftp_key
chmod 600 sftp_key
echo "$SFTP_KNOWN_HOSTS" > known_hosts
chmod 600 known_hosts
rsync -avz --delete -e "ssh -i sftp_key -o UserKnownHostsFile=known_hosts" doc/api/ $SFTP_USERNAME@$SFTP_HOST:/var/www/api.setonix
web:
runs-on: ubuntu-26.04
timeout-minutes: 60
defaults:
run:
working-directory: app
steps:
- name: 猬嗭笍 Checkout
uses: actions/checkout@v7
with:
persist-credentials: false
- uses: subosito/flutter-action@v2.23.0
with:
flutter-version-file: app/pubspec.yaml
cache: true
- name: Install dependencies
run: |
flutter pub get
- name: Generate code
run: |
cd ../tools
dart pub get
cd ..
dart run tools/generate.dart
- name: Install web plugin toolchain
run: |
sudo apt-get update
sudo apt-get install -y clang
rustup target add wasm32-unknown-emscripten
git clone --depth 1 --branch 6.0.11 https://github.com/emscripten-core/emsdk.git "$RUNNER_TEMP/emsdk"
"$RUNNER_TEMP/emsdk/emsdk" install 6.0.11
"$RUNNER_TEMP/emsdk/emsdk" activate 6.0.11
- name: Get Git Commit Hash
run: echo "GIT_HASH=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Set flavor
if: github.ref != 'refs/heads/main'
run: |
echo "SETONIX_FLAVOR=nightly" >> $GITHUB_ENV
echo "WEB_DIR=preview" >> $GITHUB_ENV
- name: Set flavor
if: github.ref == 'refs/heads/main'
run: |
echo "SETONIX_FLAVOR=stable" >> $GITHUB_ENV
echo "WEB_DIR=web" >> $GITHUB_ENV
- name: Build plugin WASM bundle
run: |
source "$RUNNER_TEMP/emsdk/emsdk_env.sh"
bash ../plugin/web/build.sh
- name: Build
run: flutter build web --wasm --release --no-web-resources-cdn --dart-define=flavor=$SETONIX_FLAVOR --dart-define=version=$GIT_HASH
- name: Generate offline worker
run: dart run ../tools/build_web_service_worker.dart
- name: Deploy to SFTP
if: github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main'
env:
SFTP_HOST: ${{ secrets.SFTP_HOST }}
SFTP_USERNAME: ${{ secrets.SFTP_USERNAME }}
SFTP_KEY: ${{ secrets.SFTP_KEY }}
SFTP_KNOWN_HOSTS: ${{secrets.SFTP_KNOWN_HOSTS}}
run: |
echo "$SFTP_KEY" > sftp_key
chmod 600 sftp_key
echo "$SFTP_KNOWN_HOSTS" > known_hosts
chmod 600 known_hosts
rsync -avz --delete -e "ssh -i sftp_key -o UserKnownHostsFile=known_hosts" build/web/ $SFTP_USERNAME@$SFTP_HOST:/var/www/$WEB_DIR.setonix