-
Notifications
You must be signed in to change notification settings - Fork 150
102 lines (98 loc) 路 3.24 KB
/
Copy pathdeploy.yml
File metadata and controls
102 lines (98 loc) 路 3.24 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
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@v2.1.0
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/butterfly.linwood
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: Install OneNote web toolchain
run: |
rustup toolchain install nightly --component rust-src
cargo install wasm-pack --locked
- name: Build OneNote web library
working-directory: .
run: dart run tools/build_onenote_web.dart
- 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
cp -rf web_nightly/* web/
- name: Set flavor
if: github.ref == 'refs/heads/main'
run: |
echo "SETONIX_FLAVOR=stable" >> $GITHUB_ENV
echo "WEB_DIR=web" >> $GITHUB_ENV
- name: Build
run: flutter build web --wasm --release --no-web-resources-cdn --dart-define=flavor=$SETONIX_FLAVOR --dart-define=version=$GIT_HASH
- 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.butterfly.linwood