ci
This commit is contained in:
parent
b93de06cc0
commit
9d30bf1d77
1 changed files with 13 additions and 10 deletions
|
|
@ -50,12 +50,12 @@ jobs:
|
|||
name: Deploy Web App
|
||||
runs-on: ubuntu-latest
|
||||
needs: deploy-backend
|
||||
if: always() # Run even if backend fails (optional, but usually good to separate)
|
||||
if: always()
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for all tags and branches
|
||||
fetch-depth: 0
|
||||
lfs: false
|
||||
|
||||
- name: Configure Git
|
||||
|
|
@ -66,7 +66,7 @@ jobs:
|
|||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
apt-get update && apt-get install -y rsync openssh-client jq
|
||||
apt-get update && apt-get install -y rsync openssh-client jq git
|
||||
|
||||
- name: Restore Flutter cache
|
||||
uses: actions/cache@v3
|
||||
|
|
@ -74,9 +74,9 @@ jobs:
|
|||
path: /opt/flutter
|
||||
key: flutter-${{ runner.os }}-${{ hashFiles('**/pubspec.yaml') }}
|
||||
restore-keys: |
|
||||
flutter-${{ runner.os }}-
|
||||
flutter-${{ runner.os }}-
|
||||
|
||||
- name: Install Flutter if missing
|
||||
- name: Install Flutter 3.35.5 if missing
|
||||
run: |
|
||||
if [ ! -d /opt/flutter/bin ]; then
|
||||
echo "Flutter not found in cache. Cloning..."
|
||||
|
|
@ -100,16 +100,19 @@ jobs:
|
|||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Build Web App
|
||||
working-directory: mnemo_cards_web_v2
|
||||
run: |
|
||||
cd mnemo_cards_web_v2
|
||||
flutter pub get
|
||||
flutter build web --release --dart-define=API_BASE_URL=https://api.memo-cards.online:8444 --dart2js-optimization=O4
|
||||
flutter build web --release \
|
||||
--dart-define=API_BASE_URL=https://api.memo-cards.online:8444 \
|
||||
--dart2js-optimization=O4
|
||||
|
||||
- name: Deploy Web App
|
||||
run: |
|
||||
# Sync build artifacts
|
||||
rsync -avz --delete build/web/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/mnemo_cards/
|
||||
rsync -avz --delete mnemo_cards_web_v2/build/web/ \
|
||||
${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:/var/www/mnemo_cards/
|
||||
|
||||
- name: Fix Permissions
|
||||
run: |
|
||||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "chown -R www-data:www-data /var/www/mnemo_cards && chmod -R 755 /var/www/mnemo_cards"
|
||||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \
|
||||
"chown -R www-data:www-data /var/www/mnemo_cards && chmod -R 755 /var/www/mnemo_cards"
|
||||
Loading…
Reference in a new issue