Created
August 14, 2022 12:12
-
-
Save ishaquehassan/e71a212def32f0544755f53b41b79467 to your computer and use it in GitHub Desktop.
Flutter web deployment with rsync using ssh
This file contains 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: CD User-Prod-Lane | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch. | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build Web and Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Setup Java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "11.x" | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v1 | |
with: | |
flutter-version: "3.0.2" | |
channel: 'stable' | |
- name: Pub Get Packages | |
run: flutter pub get | |
- name: Build Web | |
run: flutter build web -t lib/main.dart | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SERVER_KEY }} | |
known_hosts: 'just-a-placeholder-so-we-dont-get-errors' | |
- name: Adding Known Hosts | |
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Deploy with rsync | |
run: rsync -avz ./build/web/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/html/your_server_dir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment