-
Notifications
You must be signed in to change notification settings - Fork 10
132 lines (130 loc) · 4.75 KB
/
deploy.yml
File metadata and controls
132 lines (130 loc) · 4.75 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
name: Deploy documentation
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
jobs:
build-docs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v6
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
package_json_file: docs/package.json
- name: Use Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: "pnpm"
cache-dependency-path: docs/pnpm-lock.yaml
- name: Install dependencies
run: pnpm install
- 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-24.04
defaults:
run:
working-directory: server
steps:
- name: ⬆️ Checkout
uses: actions/checkout@v6
- 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
build-web:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: app
steps:
- name: ⬆️ Checkout
uses: actions/checkout@v6
- 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 toolchain install nightly
rustup +nightly component add rust-src
rustup +nightly target add wasm32-unknown-unknown
cargo install wasm-pack --locked
- 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: dart run flutter_rust_bridge build-web --rust-root ../plugin/rust --output web --release
- name: Build
run: flutter build web --wasm --release --no-web-resources-cdn --dart-define=flavor=$SETONIX_FLAVOR
- name: Copy plugin WASM bundle
run: |
mkdir -p build/web/pkg
cp -R ../plugin/rust/web/pkg/* build/web/pkg/
- name: Deploy Flutter web via 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