From b3c4ee2fa37be227afb3a14a89e6300ae441bafe Mon Sep 17 00:00:00 2001 From: Shawn Date: Thu, 26 Sep 2024 01:01:11 -0600 Subject: [PATCH] Update deploy actions --- .github/workflows/build_and_deploy_web.yml | 35 +++++++++++++++++++ .../build_and_deploy_web_staging.yml | 35 +++++++++++++++++++ .github/workflows/build_web.yml | 25 ++++++------- .github/workflows/tests.yaml | 12 ------- 4 files changed, 80 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/build_and_deploy_web.yml create mode 100644 .github/workflows/build_and_deploy_web_staging.yml delete mode 100644 .github/workflows/tests.yaml diff --git a/.github/workflows/build_and_deploy_web.yml b/.github/workflows/build_and_deploy_web.yml new file mode 100644 index 00000000..ef24945e --- /dev/null +++ b/.github/workflows/build_and_deploy_web.yml @@ -0,0 +1,35 @@ +name: Build and Deploy (Live!) + +on: + workflow_dispatch: + +env: + BASE_HREF: "web" + REMOTE_DIR: "web" +jobs: + build: + uses: ./.github/workflows/build_web.yml + + deploy: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: web-build + path: build/web + + - name: Update base href in index.html + run: sed -i 's|||g' build/web/index.html + + - name: Upload to SFTP + uses: wlixcc/SFTP-Deploy-Action@v1.2.4 + with: + server: ${{ secrets.FTP_SERVER }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + local_path: ./build/web/* + remote_path: wonderous.app/${{ env.REMOTE_DIR }} + sftp_only: true diff --git a/.github/workflows/build_and_deploy_web_staging.yml b/.github/workflows/build_and_deploy_web_staging.yml new file mode 100644 index 00000000..1044e316 --- /dev/null +++ b/.github/workflows/build_and_deploy_web_staging.yml @@ -0,0 +1,35 @@ +name: Build and Stage + +on: + workflow_dispatch: + +env: + BASE_HREF: "web-staging" + REMOTE_DIR: "web-staging" +jobs: + build: + uses: ./.github/workflows/build_web.yml + + deploy: + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: web-build + path: build/web + + - name: Update base href in index.html + run: sed -i 's|||g' build/web/index.html + + - name: Upload to SFTP + uses: wlixcc/SFTP-Deploy-Action@v1.2.4 + with: + server: ${{ secrets.FTP_SERVER }} + username: ${{ secrets.FTP_USERNAME }} + password: ${{ secrets.FTP_PASSWORD }} + local_path: ./build/web/* + remote_path: wonderous.app/${{ env.REMOTE_DIR }} + sftp_only: true diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml index 668f356b..9e12c304 100644 --- a/.github/workflows/build_web.yml +++ b/.github/workflows/build_web.yml @@ -1,13 +1,11 @@ -name: Build and Deploy Flutter Web App +name: Build Flutter Web on: - # push: - # branches: - # - main workflow_dispatch: - + workflow_call: + jobs: - build-and-deploy: + build: runs-on: ubuntu-latest steps: @@ -27,14 +25,11 @@ jobs: run: flutter config --enable-web - name: Build Flutter web app - run: flutter build web --release --wasm + run: flutter build web --wasm - - name: Upload to SFTP - uses: wlixcc/SFTP-Deploy-Action@v1.2.4 + - name: Upload build artifact + uses: actions/upload-artifact@v4 with: - server: ${{ secrets.FTP_SERVER }} - username: ${{ secrets.FTP_USERNAME }} - password: ${{ secrets.FTP_PASSWORD }} - local_path: build/web/ - remote_path: /wonderous.app/web_test/ - sftp_only: true + name: web-build + path: build/web + retention-days: 1 # Adjust as needed diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index 9704dacf..00000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: tests -on: - workflow_dispatch: - -jobs: - tests_self_hosted: - runs-on: [self-hosted, macos] - steps: - - uses: actions/checkout@v3 - - uses: subosito/flutter-action@v2 - - run: flutter test - - run: flutter test -d macos integration_test/smoke_test.dart