Created
May 27, 2023 10:25
-
-
Save gausoft/be16b7476ac9c41367ea764dd626a3a9 to your computer and use it in GitHub Desktop.
Deploy Flutter web app to remote server using rsync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checkout this article : https://zellwk.com/blog/github-actions-deploy/