-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (81 loc) · 2.84 KB
/
deploy.yml
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
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:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: docs/package.json
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
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/flow.linwood
web:
runs-on: ubuntu-24.04
defaults:
run:
working-directory: app
steps:
- name: ⬆️ Checkout
uses: actions/checkout@v4
- uses: subosito/[email protected]
with:
flutter-version-file: app/pubspec.yaml
- name: Install dependencies
run: |
flutter pub get
- name: Set flavor
if: github.ref != 'refs/heads/main'
run: |
echo "FLOW_FLAVOR=nightly" >> $GITHUB_ENV
echo "WEB_DIR=preview" >> $GITHUB_ENV
- name: Set flavor
if: github.ref == 'refs/heads/main'
run: |
echo "FLOW_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=$FLOW_FLAVOR
- 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.flow.linwood