Skip to content

Instantly share code, notes, and snippets.

@gausoft
Created May 27, 2023 10:25
Show Gist options
  • Save gausoft/be16b7476ac9c41367ea764dd626a3a9 to your computer and use it in GitHub Desktop.
Save gausoft/be16b7476ac9c41367ea764dd626a3a9 to your computer and use it in GitHub Desktop.
Deploy Flutter web app to remote server using rsync
name: Deploy to remote server
on:
push:
branches: [ develop ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: Adding Known Hosts
run: ssh-keyscan -H ${{ secrets.REMOTE_HOST }} >> ~/.ssh/known_hosts
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.0'
channel: 'stable'
- name: Flutter clean && Install dependancies
run: |
flutter clean
flutter pub get
- name: Build web app
run: flutter build web --release
- name: Deploy with rsync
run: rsync -avz --delete --force ./build/web/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_TARGET }}
@gausoft
Copy link
Author

gausoft commented May 27, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment